I have a combobox which has 10 entries in them and when you click one I want the Select entry to change based upon which one the user selects in the combobox. I have tried something similar to this but it doesnt seem to work.
if (document.getElementById('label').selectedIndex = '0')
{document.getElementById('labelname').innerHTML='choice1';}
else if(document.getElementById('label').selectedIndex = '1')
{document.getElementById('labelname').innerHTML='choice2';}
else(document.getElementById('label').selectedIndex = '2')
{document.getElementById('labelname').innerHTML='choice3';}
The problem is, whichever cam I click is always reverting to the last one giving me ‘choice3’ as my label for all 10 entries. Any help? I havent finished the code as these arent even working yet.
You code have 2 main problems.
The correct is as below: