Shadowbox clears inline event listeners

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Shadowbox clears inline event listeners

Justin Barkhuff

I'm observing the 'submit' event of a form. When I use Shadowbox to display that form (or rather, a div wrapped around the form), I lose my 'submit' event listener.

My HTML looks like this:

<a href="#myFormWrapper" rel="shadowbox">Show Form</a>
<div id="myFormWrapper">
<form id="myForm"><input type="submit" /></form>
</div>

My Javascript looks like this:

Event.observe(window,'load',function(){
$('myForm').observe('submit',function(e){ alert('Submitting form'); });
Shadowbox.init();
}

Any idea why the Shadowbox script clears my event listeners?