I need to trigger click in an html page except a div.but that div is created dynamically after page load.I have tried following code.
$('html').click(function(e) {
if(!$(e.target).hasClass('flyoutdiv') ){
}
});
It is working only for element that is not created dynamically. "flyoutdiv" is created dynamically after page load.I need to trigger click in the entire page except that element.is there any solution?
You need to attach click event to flyoutdiv div like following.
$(".flyoutdiv").on('click',function(e){e.stopPropagation();})
to handle dynamic flyoutdiv you can use the code like following.
$("body").on('click',".flyoutdiv",function(e){e.stopPropagation();})
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With