<script> elments executed twice, once when document is "ready", and again when domManip gets called
I have a pice of javascript that is on a page to bind an event
handler
to a button, somthing like:
----
<script type="text/javascript" charset="utf-8">
$(document).ready(
function() {
$("#cancelpopup").click(
function(event) {
$('#eventId')[0].value='cancelpopup';
$('#xform').submit();
}
);
}
);
</script>
---
It uses jqModal plugin, which calls domManip in this case.
domManip seems to have code in it to execute each <script> element,
which seems to cause the click event handler to get bound a second
time. (It was already bound after the page loaded initially.)
This means my form gets submitted twice when I click the button.
My question is why does the domManip function behave this way and how
best to prevent the double binding of the click event?
Any help gratefully appreciated. I came across this issue elsewhere
where another function called domManip so it is nothing to do with the
jqModal plugin.
I'm using JQuery 1.2.6 in IE7.
thanks
Conor