I have the following autocomplete that works on the 1st input, when it completes it fills the 2nd input.
The problem is that if you delete the <p>
tag it does not work. Can anyone tell me why?
Follow the code:
$().ready(function() {
$("#singleBirdRemote").autocomplete("search.php", {
width: 260,
selectFirst: false
});
$("#singleBirdRemote").result(function(event, data) {
if (data)
$(this).parent().next().find("#xx").val(data[0]);
});
});
<p>
<input type="text" id="singleBirdRemote">
</p>
<p>
<input name="asdad" id="xx">
</p>