Hi All,
In a JSP I'm having like
How to do I insert the "option element" under "old Node" at 2nd position after "AA".. Thanks in Advance..
In a JSP I'm having like
Code:
<html> <head> <script> function Alter() { var oldNode = document.getElementById("selectRows"); var optionElement = document.createElement("option"); optionElement .setAttribute("id","1"); optionElement .setAttribute("value","EE"); var optionText = document.createTextNode(newSelectText); optionElement.appendChild(optionText); // I need to append this 'optionElement' under 'oldNode' at 2nd position after "AA" } </script> </head> <body> <select id="selectRows"> <option id="1" value ="AA"> AA</option> <option id="2" value ="BB"> BB</option> <option id="3" value ="CC"> CC</option> <option id="4" value ="DD"> DD</option> </select> <input type="button" name="submit" value="submit" onClick="Alter()"> </body> </html>
Comment