假設 navbar-brand 為用jquery load進來的html
此時下面寫法無法執行
$("a.navbar-brand").on("click", function() {
//code here
});
解法一
不要用jquery load 進html,
解法二
Event Delegation
ex:
$(document).on("click", 'a.navbar-brand', function() {
//code here
});
ref:http://www.cnblogs.com/moonreplace/archive/2012/10/09/2717136.html
沒有留言:
張貼留言