javascript - How to detect the difference between a change made by a user and a change made programmatically? -


i have onchange event handler being triggered twice; once change made user, , second time change made programmatically result original user's change. event should triggered once, former. how discern between changed made user , 1 script?

if change value el.value = x, change event not triggered. example, won't log console:

var el = document.getelementbyid('el') el.onchange = function(){     console.log('changed'); }; el.value = 'asasassasa'; 

so, if you're seeing it's being triggered twice, it's either because:

  • you're manually triggering el.onchange(). in case, remove call.

or:

  • the event handler bound element more once. have locate that's happening.

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

php - joomla get content in onBeforeCompileHead function -