I have a div element which will be shown/hidden in many places. Is it possible if I do a
$("#divtobetracked").hide();
or a
$("#divtobetracked").show();
that another action is fired? Because if .hide() of the element, a button should also be hidden, and if the element wil be shown, a button should also be displayed.
So, I think I can write a function which toggle and do the things I want and I call the function if I want to show/hide the element.
But, is there another possibility, sth. like a .live() event?
Best Regards.
idin the same document; if you do then you should be using aclassinstead:$('.divtobetracked')in place of$('#divtobetracked'). Also, can you take a moment to clarify your question and title? I'm having trouble trying to work out what you're trying to ask. Guidance from @Jon Skeet.$('#divtobetracked').hide(function() {...});, a sort of "on-hide" or otherwise "on-css-change" feature. He is talking about only onediv. You're right though, because this doesn't exist, his best bet would probably be to add a class to the div as well as the button, and do a$('.toggle-elements').hide()instead.