我有这样的数据
<div class="small-box bg-aqua">
<div class="box-tools pull-right">
<button class="btn btn-box-tool" data-widget="remove"><i class="glyphicon glyphicon-edit white"></i></button>
</div>
<div class="inner">
<h4 class="show"><?=$row->name?></h4>
<input type="text" name="name" class="form-control hide" value="<?=$row->name?>" />
<p>Customer</p>
</div>
</div>
我有一个像这样的 jQuery
$('.glyphicon-edit').click(function() {
var x = $( this ).find('.inner').find('.hide').val();
alert(x);
});
如何在 jQuery 中获取隐藏类值?
最佳答案
试试这个:
$('.glyphicon-edit').click(function() {
var x = $(this).closest('.small-box').find('input[type="text"]').val();
alert(x);
});
关于javascript - 如何在 jQuery 中查找多个 div 值中的 div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31423789/