I've been trying to figure out how to set a value to a an option in a select type. But no matter how much I try to understand I just can't (feels ashamed)..
So I was hoping that you guys could help me since you've helped me so many times before.. :)
Let's say we have:
<select name="box" id="test">
<option value='tval'>Content</option>
shouldn't this next code change the text from 'Content' to 'box'?
function changeContent(form){
form.document.getElementById('test').options['tval'].value = 'box';
}
or am I completely wrong here? I've looked up so many different articles but no one could help me understand how to do this..
Thanks guys!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…