Abs
Abs

Reputation: 57946

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 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

Upvotes: 0

Views: 841

Answers (1)

Krishna K
Krishna K

Reputation: 1975

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
});

Upvotes: 2

Related Questions