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'時會發生什麼? –