2011-05-30 37 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) {}