I am not sure what is wrong but every alternate time my click event does not fire. Is there a problem with fadeIn function? I tried changing .click to .live and .on and the same problem arises.
Here is my code:
$('#form').submit(function (ev) {
ev.preventDefault();
$('#wrapper').html(html).scrollTop(0);
$('#base').fadeIn('slow', function () {
document.onkeydown = docOnKeydown;
}).click(function () {
alert('Click Fired');
});
return false;
});
IF you wish to simply add an event handler to the object in question:
trigger the click event after the fadein?
trigger click I(potentially while fadein)
EDIT: Just and the handler when the rest is added
better: for the handler if the base has a container. tag to that as more “local” than the document for performance reasons.
EDIT BASED ON COMMENT:, “it exists already” this should also work and be simpler on the DOM: