Hi, I am creating Html element select and setting its width using javascript But For Mozila var newlistOperation = document.createElement("select"); newlistOperation.setAttribute("style", "width:191px"); works. For IE var newlistOperation = document.createElement("select"); newlistOperation.setAttribute("width", "191px"); works I do not want to check browser type and then set width accordingly. How can I set width of select element so that it works for both IE as well as Mozila Thanks waiting for your response.
Why not: var newlistOperation = document.createElement("select"); newlistOperation.setAttribute("style", "width:191px"); newlistOperation.setAttribute("width", "191px"); Code (javascript): Mozilla will ignore the IE attribute, and IE will ignore the mozilla attribute. So simply calling both should do the trick.