The jQuery click binding is never fired in IE8 (works in IE9, Chrome, etc.) How can I get the click event to fire in IE8, and why is it not currently?
Note: I’ve tried changing the href to ‘#’, but that is not working either.
$('<a/>', {
id: 'anchor-id',
href: 'javascript:void(0);',
'class': 'button-next',
html: 'HTML'
}).click(function() {
alert('clicked');
}).appendTo($('#append'));
version: 1.7.2
Have you tried using
.on()?.on()will create an event handler for all current and future elements that match your selector. In the statement below theclickevent will be handled for all elements with a class ofbutton-nextregardless of when they are added to the DOM.