2011-05-30 38 views
0

autocomplete在父页面的动态加载的内部div中不起作用? 我有一个按钮在父页面,当我点击,然后另一个HTML被加载到父页面的空div,但那个加载另一个页面有auotcomplete下拉,但该自动完成不能在该加载的窗体中工作。 我的代码是: another.htmlautocomplete在父页面的动态加载内部div中不起作用?

 
<script type="text/javascript" src="jquery.js"></script> 
<script type='text/javascript' src='jquery.autocomplete.js'></script> 
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" /> 
<script type="text/javascript"> 
$("#course").autocomplete("includes/addcandidate/get_course_list.php", { 
width: 260, 
matchContains: true, 
selectFirst: false 
    }); 
}); 
</script> 
<td align="left"></td> 

Parent.html

 
<input type="button" class="button small green" value="getCourseList" onclick="getCourseList();"> 
<div id = "getCourseList_innerDiv"></div> 

当我像http://localhost/parent.html 浏览器中打开这个页面它与getCourseList按钮名称打开当我按下那个按钮,然后另一个。 HTML是加载在div getCourseList_innerDiv.Upto现在工作正常,但问题是,当another.html加载的内部div自动完成不工作,所以请任何一个能帮助我,我将greatfull你......请

回答

0

您自动完成处理程序添加到的document.ready这样

$(document).ready(function(){ 

$("#course").autocomplete("includes/addcandidate/get_course_list.php", { width: 260, matchContains: true, selectFirst: false }); }); 

}); 

别人添加到一些现场自动完成处理程序点击功能如

$("#course").live('click',function(event) {}