-1
我有這樣的代碼:的jQuery的onclick不能達到的功能
cs = new Object();
cs.show = function() {
$.getJSON('script.php', function(rd) {
var result = '<button id="sellbutton">PLACE TRADE OFFER</button>';
$('#someDOM').html(result);
$('#sellbutton').click(function() {
cs.doSomething();
})
})
}
cs.doSomething = function() {
// doing something
}
當我點擊button
,我越來越:
Uncaught TypeError: cs.doSomething is not a function(…)
問題出在哪裏?
這是你的完整碼?你在哪裏調用'cs.show()'?適用於我:[示例](https://jsfiddle.net/b8xt33Lr/) – empiric
對不起,我忘記了alax電話,是的,這是完整的代碼,即時100%它工作一個月前,並經過測試。 Chrome更新有可能發生變化? – Martin
它應該(並且)仍然可以使用getJSON調用:https://jsfiddle.net/b8xt33Lr/1/ –