I'm working on an application with modal overlays that appear within iFrames when the corresponding buttons are pressed. To close one of these modal overlays, the Cancel button is defined in the parent window this way:
<a href="#close" class="modalButton">Cancel</a>
I'd like to replace this with a JavaScript function (let's call it onCancel() ) so I can reset some values if needed in addition to closing the overlay. What is the JavaScript equivalent to "#close"?
href="#close"
is just a link that jumps to theclose
-anchor (name="close"
). If this does anything else there is other code triggering on click.#close
won't "close" an iframe (by which I assume you mean "remove it from the DOM"). It's a link to an element withid=close
. You probably already have some JavaScript intercepting that to get the effect you want, but we can't see that JS.