Q:

How to detect a textbox's content has changed using jQuery?

0

How to detect a textbox's content has changed using jQuery?

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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');
});

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now