Setting name attribute for an element dynamically in IE

by Rekha 2009-10-15 15:06:59

Normally we will use the following to create an element dynamically,


var sell = document.createElement("select");
sell.setAttribute("id",val);
sell.setAttribute("name","ss");
sell.setAttribute("onChange","sett()");


This will work in Firefox but not in IE.To make it work in IE use the following code,


var sell = document.createElement("<select name=ss>");
sell.setAttribute("id",val);
sell.onchange = function(){sett()};



This will work in Internet Explorer.

Tagged in:

1183
like
0
dislike
0
mail
flag

You must LOGIN to add comments