My page has six div elements.
Using jQuery and Z-Index, clicking on a button increases the width of one div to cover all the others. In the process, it also assumes the class: active (z-index:900).
When I click another button, the div with the class active should return to its original size and position. The original values are saved into variables, but how can I know the name of the element with the active class?
This is one of the fundamental features of the
jQueryfunction aka$().Doing this:
will give you all of the elements that are using CSS class
myclass. From there you can do this:The style changes will apply to all of the elements at once.
However if you wish to restore an element to its defaults (ie what was in the original html), you can do this:
or even: