cleary1981 Posted November 14, 2008 Share Posted November 14, 2008 Hi, I want to use javascript to set the value of a select box shown below. <select id="panel_type"> <option id="f">FLOOR STANDING</option> <option id="w">WALL MOUNTED</option> </select> for example if this was a text box i would simply write document.company1.panel_type.value = "FLOOR STANDING"; how do I achieve this if I was using the above select instead? Link to comment https://forums.phpfreaks.com/topic/132692-solved-set-the-value-of-a-select-with-javascript/ Share on other sites More sharing options...
DarkerAngel Posted November 14, 2008 Share Posted November 14, 2008 with your code... document.getElementById('f').value = "MyValue"; document.getElementById('f').innerHTML = "My Value"; Link to comment https://forums.phpfreaks.com/topic/132692-solved-set-the-value-of-a-select-with-javascript/#findComment-690072 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.