Call A Jquery Function After Dom Changed With An Event
I have the following jquery clickno class generated after a click event. It is a class in popover generated after a click event. $('.clickno').on('click', function(){$(this).pare
Solution 1:
Delegate the event to parent of .clickno
if you know it parent or delegating the event to document could also do that for you.
$(document).on('click', ".clickno", function()
{$(this).parent().parent().parent().hide()
});
Delegated events
Delegated events have the advantage that they can process events from descendant elements that are added to the document at a later time. By picking an element that is guaranteed to be present at the time the delegated event handler is attached, you can use delegated events to avoid the need to frequently attach and remove event handlers, reference.
Solution 2:
Move this
$(".clickno").on('click', function(){$(this).parent().parent().parent().hide()})
inside the click event code of the element on which the popover is loaded.
Eg:
$(".button_that_loads_popover").on('click',function({
// Pop-over loaded
$(".clickno").on('click', function(){$(this).parent().parent().parent().hide()});
}));
Post a Comment for "Call A Jquery Function After Dom Changed With An Event"