[Greasemonkey] Adding an onsubmit
esquifit
esquifit at yahoo.de
Sun Jan 8 16:42:36 EST 2006
It works for me (GM 5.3/FF1.0.7 on WinXP). Are you getting error
messages in the js console? Maybe there is some conflict with other
parts of the script?
On Sun, Jan 08, 2006 at 03:05:58PM +0000, WHITEMARE2 wrote:
>
> I replaced a rich text editor on a site using a script. Everything is working okay, except I need to add some code when the form is submitted. The form already has an onsubmit event defined for form _pttmf on the original page. I tried this code, but the newsubmit function is not called when I click the submit button. What am I doing wrong?
>
> function newsubmit(event) {
> alert('newsubmit');
> }
>
> document.getElementById('_pttmf').addEventListener('submit', function(e) {
> // stop the event before it gets to the element and causes onsubmit to
> // get called.
> e.stopPropagation( );
>
> // stop the form from submitting
> e.preventDefault( );
>
> newsubmit(e);
> }, true);
More information about the Greasemonkey
mailing list