I had created a dynamic select box, [add/remove value from text box] for one of my javascript. It just works perfectly in firefox and the customer happy with it. But it doesn't work in IE (surely I will be blamed since most of the user using IE).
I need to add/remove node in select box. So I just refer to website one of javascript guru. It just using method appendChild and removeChild, duhh. But IE don't like it. I had tried debug using the Internet Explorer Developer Toolbar (doesn't help me, explore DOM in firefox much better). After spent some time googling, I got a nice article. Snippet below solved my problem.
try {
elSel.add(elOptNew, null); // standards compliant; doesn't work in IE
}
catch(ex) {
elSel.add(elOptNew); // IE only
}
No comments:
Post a Comment