0
我想使用AJAX加载一些输入&选择显示后来在页面上。我正在做这样的事情。选择onfocusin做什么不工作
<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
});
的结果是选择和投入,从页面呈现的开始存在,但不是元素后出现了确定。有人知道这里发生了什么吗?谢谢!
它似乎运作良好。但是如果我想让它在没有focusin事件的情况下自动加载呢? – 2014-11-03 03:47:23
@ChandlerLee我不确定你的意思是...? – Ohgodwhy 2014-11-03 04:02:56
我的意思是如果我使用focusin事件,那么我需要在ajax加载之前单击select并追加选择。有没有办法像这样使用委托加载ajax内容? – 2014-11-03 04:12:50