Input event triggered on Internet Explorer when placeholder changed

html, javascript

Solution

checking if input is focused should be enough

$('input').bind('input',function(){
    if($(document.activeElement) != $('input'))
        return;
    alert('input even occur');
});

this also "fixes" the input event being triggered without any actions when placeholder contains an accented character

Problem

As it is shown in this jsfiddle example when i change placeholder it triggers input event. I tested it on I.E 11 version but i guess that older versions have same problem. The other browsers does not behave like this. Is this I.E bug ? If so what is workaround for this problem on I.E ? Here is html markup. ``` <input type="text" /> <button>Change PlaceHolder</button> ``` And here is javascript part. ``` var i = 0; $('button').click(function(){ $('input').attr('placeholder','placeholder ' + i++); }); $('input').bind('input',function(){ alert('input even occur'); }); ```

Original source

Related problems