attaching event to form submit using jquery -


we have large application 100 jsp pages. when submit form (using javascript), cursor not change. there way dynamically intercept form submit , change cursor using jquery? unfortunately, selector using named form may not possible; also, want keep function generic forms including in common js file.

i tried following code, did not work. there way have selector similar i'm trying below?

function cursorwait(e) {     document.body.classname = 'wait'; }  $(function () {     var jspform = $('form');     var fmsubmit = jspform.onsubmit;      jspform.onsubmit = function () {         cursorwait();         if (fmsubmit) {             fmsubmit.call(jspform);         }     } }); 

$('form').submit(function(){   document.style.cursor = 'wait'; }); 

very primitive, believes performs you're asking for.

follow-up:

  • .submit() event binder provided jquery (so no need try use onsubmit , cross-browser compliant)
  • this "adds functionality" submit--it won't interfere, reject or otherwise block form submit (e.g. using client-side validation , form failed)--this require additional logic handle circumstance.
  • i applied cursor style whole document, can add body class within same code block.

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -