alert($('.input-large[name="name"]:parent:parent').html());
我的 html 是:
<div class="control-group">
<label for="name" class="control-label">Clinic Name</label>
<div class="controls">
<input type="text" name="name" id="name" class="input-large" value="">
</div>
</div>
我的警报为空。如何找到输入元素的父元素的父元素?
最佳答案
尝试
alert( $('#name').parent().parent().html() );
关于javascript - jquery组合多个选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11694467/