trigger the submit event for the selected elements: - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:submit

Description

trigger the submit event for the selected elements:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("form").submit(function(){
        console.log("Submitted");
    });/*from   www.ja  v a 2 s .  com*/
    $("button").click(function(){
        $("form").submit();
    });
});
</script>
</head>
<body>

<form action="">
  First name: <input type="text" name="FirstName" value="Bond"><br>
  Last name: <input type="text" name="LastName" value="Mary"><br>
</form>

<button>Trigger submit event</button>

</body>
</html>

Related Tutorials