jQuery自动完成选择事件后,简单的文本字段更改。我想拆分数据并将其显示在其他文本字段中。我正在尝试这个。这根本不会改变任何值。我需要在这里更改什么?jQuery - jQuery自动完成选择事件后的文本字段值更改
$(function() {
$("#term").autocomplete({
source: function (request, response) {
$.post("https://stackoverflow.com/users/search", request, response);
},
minLength: 2,
select: function(event, ui){
$('#div2').html(ui.item.value); #doesn't populate with new text.
document.getElementById('#found').value="test"; #for test
} #doesn't populate with new text.
#I want selected data to go here in the 'found' element id
});
});
红宝石/ HTML -
<%= text_field_tag :found, nil, :maxlength => 11, :size => 20%>
<input id="found" maxlength="11" name="found" size="20" type="text" />
什么类型的元素是'#found'? –
@AndrewWhitaker - 文本字段。 ''%= text_field_tag:found,nil,:maxlength => 11,:size => 20%>' –
'select'事件是否会触发?当你在处理程序中放置一个'alert'时会发生什么? –