Hi,
I'm trying to set SELECT menu values dynamically in JS.
Normally I would use:
However if I want to set the text and the value, it fails:
Any ideas?
I'm trying to set SELECT menu values dynamically in JS.
Normally I would use:
Code:
document.getElementById('selectmenu').options[0] = "Option One";
However if I want to set the text and the value, it fails:
Code:
document.getElementById('selectmenu').options[0].text = "Option One";
document.getElementById('selectmenu').options[0].value = "1";
Any ideas?