Onsubmit executing JavaScript function - Javascript jQuery

Javascript examples for jQuery:Form Submit

Description

Onsubmit executing JavaScript function

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <title>  Jonathan Beck</title> 
 </head> /*from w  w w .  j a v a  2 s. c om*/
 <body translate="no"> 
  <form onsubmit=" return  nbpostFn('a', 'b'); "> 
   <textarea id="nbpost" placeholder="Create a post..."></textarea> 
   <button>SUBMIT</button> 
  </form> 
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> 
  <script>
function nbpostFn(element,name) {
  console.log("WORKING");
  return false;
}
  
      </script>  
 </body>
</html>

Related Tutorials