You can check this if nothing comes first (usually in my case):
if (document.getElementById('subs').selectedIndex == 0){
To still compare based on the value, do the following:
var sel = document.getElementById('subs'); if (sel.options[sel.selectedIndex].value == 'nothing') {
You can change your markup so that the label is near, for example:
<select name="subs" id="subs"></select><label id="subn" for="subs"></label>
Otherwise, this part: .innerHTML = "Subject is Required!"; erases your <select> :)
Nick craver
source share