开发者

Adding a link using JQuery html() is not click-able on IE6

I add html to a page using JQuery's html() function. This works great on most browsers except IE6.

I can work round this by adding a click event 开发者_JAVA技巧etc but I want to fix the issue without extra tape!

Any ideas why this doesn't work on IE6?

$('#button_holder').html('<a href="#" onclick="run_activity_upload(); return false;" id="save_button">Upload</a>');

Thanks, Abs


Maybe you can try this?

// add html
$('#button_holder').html('<a href="#" id="save_button">Upload</a>');

// add click listener on save button
$('#save_button').click(function(e) {
    run_activity_upload();
    e.preventDefault();    // same as return false in onclick
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜