开发者

Get drop down menu value on Jquery

开发者 https://www.devze.com 2022-12-31 03:38 出处:网络
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.

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);
});
0

精彩评论

暂无评论...
验证码 换一张
取 消