Get drop down menu value on Jquery
Got a simple question. I would like to get a drop down menu value when a use clicks it. I tried to write 开发者_如何转开发the code on my own, but couldn't do it. Any helps would be appreciated.
My Jquery
$("#week").change(function(){
var input=$("week: select").val();
alert(input); //display undefiend
My Html
<form id="week">
<select>
<option>Week 1</option>
<option>Week 2</option>
<option>Week 3</option>
<option>Week 4</option>
<option>Week 5</option>
</select>
</form>
Do this:
$("#week select").change(function(){
var input = $(this).val();
alert(input);
});
精彩评论