Javascript JQuery';s Change()事件不';t捕获自动完成选择的值
我在文本框中定义了一个Onchange事件,如下所示Javascript JQuery';s Change()事件不';t捕获自动完成选择的值,javascript,jquery,Javascript,Jquery,我在文本框中定义了一个Onchange事件,如下所示 $('input[ComponentAttribute]').on("change",function () { dataTxt = ""; var thisID = $(this).attr('id'); var temp = $('#' + thisID).val(); if (!(temp.trim()=='
$('input[ComponentAttribute]').on("change",function () {
dataTxt = "";
var thisID = $(this).attr('id');
var temp = $('#' + thisID).val();
if (!(temp.trim()=='')) {
// alert($(this).attr('ComponentAttributeID') + " - " + temp);
placeholder[$(this).attr('ComponentAttributeID')] = temp;
for (var key in placeholder) {
if (key === 'length' || !placeholder.hasOwnProperty(key)) continue;
var value = placeholder[key];
dataTxt += key + ":" + value + ";";
}
$('[DataAttributeValue]').text(dataTxt);
}
});
现在,当用户通过键盘输入值时,事件触发。但当用户如图所示从Autocomplete中选择一个值时,事件不会触发。我这里缺少什么?试试:$('input[ComponentAttribute]')。在('change keyup',function(){使用控制台$('idValue')测试一个简单的自动完成。在('change',function(){alert('hello');});工作时,[ComponentAttribute]的预期值是多少?Component属性用于过滤整个表单中的潜在输入字段,用户可以在其中输入valueright,但作为一个变量,它在运行时生成什么值?我只使用它,但不为此属性分配值,以使其可用于过滤输入控件