Reputation: 15303
I am trying to add a listener with input
element on propertychange
, but it's not working at all.. I tried with chrome as well ie11 both not responding.
is my approach is wrong or is it require any other workarounds?
here is my code :
<form>
<fieldset>
<label>Username: <input type="text" /></label>
</fieldset>
</form>
var callme = function () {
console.log('i am called'); // not calling chrome, ie..
}
$('input[type=text]').on('propertychange', callme);
thanks in advance!
Upvotes: 1
Views: 992
Reputation: 187
First encapsulate your JS-code in the $(document).ready(function(){});
I can't see you did, but maybe you did.
In HTML5 there is a new event, "input", which behaves exactly like you seem to think "change" should have behaved - in that it fires as soon as a key is pressed to enter information into a form In older, pre-HTML5 browsers, "keyup" is definitely what you're looking for.
use the event .on('input').
See working example: jsfiddle.net/5ex4V/1/
Upvotes: 1