IE, DOM and Select onChange
Hi,
I have a dynamically created combobox(<select> <option>). I need to add an 'onChange' event handler for this.
I have already tried the following, pls see that both the methods work in Mozilla but not in IE -
Code:
theCombo.setAttribute("onChange", "callOnChange()");
Code:
theCombo.onChange = "callOnChange()";
var onChangeHandler = new Function(theCombo.onChange);
if( theCombo.addEventListener )
theCombo.addEventListener("change", onChangeHandler, false);
else if( theCombo.attachEvent )
theCombo.attachEvent("onChange", onChangeHandler);
I kinda need this urgently, pls tell me how to make it work in both Mozilla and IE...
Thanks in advance...