I want to determine when text input changes. I tried these that worked in firefox but not in 8.
$('#taskSearch').bind('input', function() { alert($(this).val()); }); $('#taskSearch').live('input', function() { alert($(this).val()); }); $('#taskSearch').change(function() { alert($(this).val()); });
You can use onpropertychange for IE6 +:
onpropertychange
$("#taskSearch").on("propertychange", function(){ alert($(this).val()); });
The last (and only the last) is correct, but you are missing the closing parenthesis:
$('#taskSearch').change(function() { alert($(this).val()); });
.live() deprecated (and the syntax is incorrect), and the syntax for .bind() also incorrect; the event name is 'change' , not 'input' . See the documentation for .change() .
.live()
.bind()
'change'
'input'
.change()
The following solution works for me in IE8 and modern browsers for both changes using the keys, scroll, or arrow buttons in the input field type = "num":
$('#element').on('keyup change', function() { // do something });
https://github.com/spicyj/jquery-splendid-textchange is a plugin for fixing quirks of emulating "input" in IE8 and IE9.
The author described how he reached this decision on his blog ( http://benalpert.com/2013/06/18/a-near-perfect-oninput-shim-for-ie-8-and-9.html ), which really complicated, read if you want to know the details.
$('#taskSearch').change(function() { alert($(this).val()); // not the extra brace I've added });
It should just work. .live() stop using .live() .
This will detect when a key is pressed in IE8
$ ("# input"). on ('keyup', function (event) {alert ('keypress');});
To start immediately when the input value changes:
$('#example')on('keyup input', function(e){ alert(e.type); // Displays 'keyup' in IE8, 'input' in browsers });
(This is an answer from Mark)