jQuery - jquery 自动完成选择事件后的文本字段值更改
jQuery - text field value change after jquery auto complete select event
jquery自动完成选择事件后更改简单文本字段。我想拆分数据并将其显示在其他文本字段中。我正在尝试这个。这根本不会更改任何值。我需要在这里更改什么?
$(function() {
$("#term").autocomplete({
source: function (request, response) {
$.post("/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
});
});
Ruby/html -
<%= text_field_tag :found, nil, :maxlength => 11, :size => 20%>
<input id="found" maxlength="11" name="found" size="20" type="text" />
更改此行:
document.getElementById('#found').value="test"; #for test
自:
$('#found').val('test');
相关文章:
- 将输入字段中的文本提交到我的数据库,同时将其添加到我的列表中
- 当设置addFromAutocompleteOnly时,剩余文本将保留在输入字段中
- 使用jquery将输入字段转换为文本
- 如何从查询字符串中的输入字段发回文本
- 表单输入字段随着溢出的文本而增长
- 使用单个文本框向多个字段添加严格搜索
- 使用javascript提交表单并从字段/单选框/复选框/文本区域获取数据
- 使用jQuery的输入字段文本换行
- 向使用jQuery加载DOM后添加的字段添加不受限制的文本输入DatePickers
- 当用户单击按钮(在光标位置)时,在输入字段中添加一个文本字符串
- 如何根据文本长度立即显示和隐藏字段?-JQuery
- 如何使文本、数字和日期html输入字段以一致的方式支持Ctrl+Z(撤消)
- 模拟文本输入字段上的退格键
- 输入字段中的可持续文本
- 未获取文本输入字段的值
- 没有文本安全性的密码字段
- 将禁用的输出字段更改为带前缀的文本
- 为什么 react 将输入[类型=“文本”] 字段设为只读,除非我提供 onChange 回调
- 使用SAPUI5中的“文本”字段显示正确的“日期”
- Kendo,如何将MVVM文本:字段绑定到远程DataSource