我正在尝试使用 AJAX 加载稍后显示在页面上的一些输入和选择。我正在做这样的事情。
<input type='product' alt='2'/>
$("input[type='product']").on("focusin", function(){
var product_type_ids = $(this).attr('alt');
$(this).autocomplete({
// ajax load the information here
});
});
<select type='product' alt='2'/>
$("select[type='product']").on("focusin", function(){
var product_type_ids = $(this).attr('alt');
// some codes here
});
对于从页面呈现开始就存在的选择和输入,结果是可以的,但对于稍后出现的元素则不行。有谁知道这里发生了什么?谢谢!