I am currently trying with a modal window popup. Essentially it come in and takes over the whole window.
<div id="popup">
<div id="modal">
<div id="closeBox"><span id="x">X</span></div>
<form>
form stuff..
</form>
</div>
</div>
Now when I target my #closeBox
like..
$("#closeBox").click(function() {
$("#popup").remove();
});
The event never fires. I believe this is because it is nested, if I switched #closeBox
to html
the event fires and it works, as it does if I switch it to #popup
. How can I target the nested element so that it only fires when #closeBox
is clicked?