javascript - Perform function on form submit -


Hope this is a very simple question! I will listen to the code working in jQuery for a specific form on one page and display a warning when it will happen .. Ie: The form does not have its own ID, so I am targeting a particular form DIV ID

  $ ("#content form"). Submit (function () {Alert ("Laurem Epsom Dollar?");});  

What would the syntax do to javascript without using jquery? For example, I have this code (below) and how it is mandatory to listen for a compulsory form to submit.

  var submit form = document GetElementById ("content") .getElementsByTagName ("form");  

Thanks!

To do this in a cross browser, in a destructive way, it takes a bit of code:

  var submitconf = document.getElementById ("content"). GetElementsByTagName ("Form") [0], Callback = Function () {Warning ("Laurem Epsom Dollar?"); }; If (window.addEventListener) {submitform.addEventListener ("submit", callback, incorrect); // most modern browsers} and if (window.attachEvent) {submitform.attachEvent ("onsubmit", callback); // IE} Other {submitform.onsubmit = callback; // destroys other handlers)  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -