javascript - IE onpropertychange event doesn't fire -
<a href="javascript:void(0)" id="select-handler">select</a> <input type="file" id="real-file-input" style="display:none" /> $('#select-handler').click(function(){ $('#real-file-input').click(); }); $('#real-file-input').bind('propertychange', function(){ alert('changed'); });
it's weird when use .click()
propertychange
won't fired.
actually code works fine in ie7 , 8 me, whenever change value of input type ='file'
, alert fired. whereas not working in >ie9 versions.
from paulbakaus's blog on propertychange
on internet explorer 9
what’s wrong
propertychange
on ie9?
ie9 doesn’t fire non-standard events when binding them through addeventlistener. every modern js library uses feature detection, including jquery, fail (see also: http://bugs.jquery.com/ticket/8485). “not biggie” say, “simply use attachevent directly” say?
the news: propertychange fires when using attachevent. bad news: refuses fire when modifying css properties on element unknown engine.. “well sucks,” say, “but read can use domattrmodified on ie9!” say?
domattrmodified
features same behavior. not fire unknown css properties. complete disaster.
many developers faces same weird behavior.
why want use onpropertychange
supported internet explorer?
i rather move on change
event handler
$('#real-file-input').bind('change', function(){ alert('changed'); });
or if html5 input
event handler.
$('#real-file-input').bind('input', function(){ alert('changed'); });
Comments
Post a Comment