How to detect a textbox's content has changed using jQuery?
HTML Code :
<!DOCTYPE html> <html> <head> <script src="https://code.jquery.com/jquery-git.js"></script> <meta charset="utf-8"> <meta name="viewport" content="width=device-width"> <title>How to detect a textbox's content has changed using jQuery</title> </head> <body> <form action="demo_form.asp"> First name: <input type="text" id="name1" name="fname"><br> Last name: <input type="text" id="name2" name="lname"><br> <input type="submit" value="Submit"> </form> </body> </html>
JavaScript Code:
$('#name1').on('input', function() { console.log('New First name added'); });
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
HTML Code :
JavaScript Code: