aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes option values are not being shown when using javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "option values are not being shown when using javascript" Watch "option values are not being shown when using javascript" New topic
Author

option values are not being shown when using javascript

puja shaw
Ranch Hand

Joined: Nov 06, 2012
Posts: 32

posted Today 17:09:20


i am stuck with a problem regarding javascript.I am trying to add an option to the select box and add a value to that option through javascript.The option is getting added but the value is not being shown in that option.I am not able to figure out where the problem lies.Can you please help me.




<html>
<body>
<select id="SelectHidden" name="SelectHiddenThing" onClick="MyFunction1();">



<select/>

<script>


function MyFunction1(){

var box=document.getElementById("SelectHidden");

var anoption=document.createElement("OPTION");


alert("*******"+anoption);

box.options.add(anoption);

anoption.innerText="two";

anoption.Value="2"

};


</script>

</body>

</html>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: option values are not being shown when using javascript
 
Similar Threads
unable to access the values of dynamically newly added rows to table
Help needed with onChange()
Dynamic drop down box
DOM and adding a brand new select list
document.getElementById() not working