views:

54

answers:

1

why this doesn´t work:

inputButton.addEventListener('onchange', jsFunction, false);

I change the inputbox and it doesn´t call jsFunction.

+3  A: 

Try change instead of onchange

inputButton.addEventListener('change', jsFunction, false);
Soufiane Hassou
Expanding: We're used to the DOM0 names `onchange`, `onload`, etc. Those were the names of the attributes we used back in the day. The standard DOM2 stuff does away with the "on" part -- so, `change`, `load`, etc. IE's non-standard DOM2 equivalent, `attachEvent`, retains the "on". So the rule is, with `addEventListener`, there's no "on"; with just about everything else, there is.
T.J. Crowder
thank you guys, that did the trick.
Fernando SBS