2012-06-10 51 views
1

我使用jQuery彈出,但它從阿賈克斯彈出Ajax響應後不工作

加載它的popup.js

之間

$(document).ready(function() { 
    $('a.poplight[href^=#]').click(function() { 
    // code here 
    } 
    }); 
我必須使用委託後不工作?
因爲文件準備好了是否是問題?

注:
我試圖刪除文件準備和使用該

$(document).delegate("a.poplight[href^=#]",'click',function(e){ 
// code here 
} 

,但它不工作

任何幫助嗎?

問候

回答

2

你可以試試這個

(jQuery的> = 1.7)

$(document).on('click',"a.poplight[href^=#]",function(e){ 
// code here 
}); 

OR

$('a.poplight[href^=#]').live(function() { 
    // code here 
}); 

OR

$('body').delegate('a.poplight[href^=#]', 'click', function() { 
    // code here 
}); 
+0

它不工作我不使用jquery 1.7+ – KJA

+0

@KJA哪個版本的jQuery? – thecodeparadox

+0

jquery 1.4版 – KJA