I am trying to built a select option menu. If the user chooses the first (default) option, the alert window should be shown, but it isn’t shown. Need help, thanks!
Here is my html code
<select name="sets" id ="selectset">
<option value="General">Select Set</option>
<option value="The Happy Couple">Ceremony</option>
<option value="Ceremony">Ceremony</option>
<option value="Lunch">Lunch</option>
<option value="Garden">Garden</option>
<option value="Longname">This is max length</option>
</select>
<input type="button" class="form_button" id="movetoset" value=" Move Marked to Set">
Here is my javascript code
$('#movetoset').click(function() {
if(document.getElementById("selectset").value == "General"){
alert("Please choose a set");
}
}
Why aren’t you using jQuery for getting the value of the select as well?
http://jsfiddle.net/davelnewton/CUGva/