File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: option values are not being shown when using javascript
 
Similar Threads
document.getElementById() not working
Dynamic drop down box
unable to access the values of dynamically newly added rows to table
DOM and adding a brand new select list
Help needed with onChange()