I’m trying to execute jQuery code when a div’s style changes from display: none; to display: block;
I’m using tabs that’s why this div’s style changes like this, and this jQuery code should only be running when viewing this tab only.
so how can I achieve this ?
and thanks.
EDIT: I tried .is(':visible'); and it only works if we load the page and this div is visible, not if this div will be visible later.
What you’re looking for are DOM Mutation Events, which can raise an event when a DOM element is inserted, deleted or modified.
Unfortunately they were never well supported, and were deprecated in DOM3.
In any event (no pun intended), in your case it would be simpler just to catch whatever UI event it is that causes the tab to be displayed.