JavaScript 获取 class 为 xuanze 的父 div 下 input 的值
$(function() { var daanArray = {};
$('.xuanze').click(function(e) { $(this).toggleClass('redBorder'); var parentDiv = $(this).closest('.xuanze-parent'); var inputValue = parentDiv.find('input').val(); console.log(inputValue); }); });
原文地址: https://www.cveoy.top/t/topic/o41I 著作权归作者所有。请勿转载和采集!