自动完成不使用Ajax生成的文本框工作 [英] autocomplete not working with ajax generated textbox
问题描述
在我的网页,我使用Ajax生成/显示按钮点击后,一个文本框。我使用自动填充功能在这个文本框,但自动完成呼叫没有发射过。我看不出在Firebug自动完成呼叫,当我试着输入在文本框中任何东西。
但它是在一个普通的测试页面里面有一个文本框(没有Ajax代)做工精细,因此这意味着jQuery的同时,自动完成文件都还好。
我怀疑AJAX生成的文本框的ID应该自动完成功能以不同的方式来调用。我附上下面我想什么样的方式。
<脚本>
$(函数(){
$(#orderingparty2)自动完成(自动/ findparty.cfm)。
})
< / SCRIPT>
绑定code添加自动填充功能在产生输入框中输入AJAX功能。你还能像的onclick任何情况下触发事件autcomplete
$(#orderingparty2)。生活('点击',功能(事件)
{$(本).autocomplete(自动/ findparty.cfm);
});
In my page I am using ajax to generate/show a textbox after button click. I am using autocomplete functionality in this textbox, but autocomplete call is not firing off. I cannot see the autocomplete call in firebug when I try to enter anything in the textbox.
But at the same time it is working fine in a plain test page which has a textbox (without ajax generation), so that means jQuery, autocomplete files are okay.
I am suspecting ajax generated textbox's ID should be called in autocomplete function in a different way. I have attached below what way I tried.
<script>
$(function(){
$("#orderingparty2").autocomplete("auto/findparty.cfm");
})
</script>
Bind the code adding autocomplete to the ajax function which is generating the input box. Else you can trigger the autcomplete event on any event like onclick.
$("#orderingparty2").live('click',function(event)
{
$(this).autocomplete("auto/findparty.cfm");
});
这篇关于自动完成不使用Ajax生成的文本框工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!