我正在处理用户在隐藏元素内跳转到输入内容的场景。当这个输入集中时,我希望它的父对象是隐藏的元素,用jQuery来显示。到目前为止,我似乎无法得到这个工作。在隐藏元素内跳转到输入
这是我的HTML看起来像:
<div class="select">
<input tabindex="1" type="text" name="search" class="address" id="address-1" placeholder="Tab to the next input.">
<div class="dropdown">
<div class="dropdown-search">
<input tabindex="2" type="text" name="search" class="search" id="dropdown-search-1" placeholder="Type to search...">
</div>
</div>
和jQuery的:
$('.select').each(function() {
var dropdown = $('.dropdown', this),
search = $('.search', this);
search.focus(function() {
dropdown.show();
});
});
我也把我的代码在这里:http://jsfiddle.net/ae26u/1/
此处更新:http://jsfiddle.net/ae26u/3/ - 您无法选择隐藏元素,因此无法显示其父项。 –