Try It Editor
Tip: Press
Ctrl/⌘ + Enter
to Run
▶ Run
Reset
Copy
Download
Code
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Form Events: input/change/blur/submit</title> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <style>#msg{margin-top:6px;}</style> </head> <body> <form id="f"> <input id="email" name="email" placeholder="Email"> <button type="submit">Submit</button> </form> <div id="msg"></div> <script> $("#email").on("input", function(){ $("#msg").text("Typing: " + this.value); }); $("#email").on("change", function(){ $("#msg").text("Changed to: " + this.value); }); $("#email").on("blur", function(){ $("#msg").text("Blurred at: " + this.value); }); $("#f").on("submit", function(e){ e.preventDefault(); $("#msg").text("Submitted with: " + $("#email").val()); }); </script> </body> </html>
Output