How to Detect Change in a Text Input Box in jQuery
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Use the
input
EventYou can bind the
input
event to an input text box usingon()
method to detect any change in it.The following example will display the entered value when you type something inside the input field.
Note that the input event fires on keyboard input, mouse drag, autofill and even copy-paste. But, it will not fire if you paste the same string or select and retype the same character, etc. inside the input.
Also, if you use the change event here it will not work as expected, since in case of text inputs the change event fires only when the element loses focus (i.e. onblur). Try the above example by replacing the string "input" with "change" (line no-8), and see how it works.
need an explanation for this answer? contact us directly to get an explanation for this answer