how to get the value from dropdownlist in jQuery

后端 未结 6 1048
旧时难觅i
旧时难觅i 2021-01-13 22:00

i have a dropdownlist in my web-page how i can get the value from the selected option of them

like


                        
    
提交评论

  • 2021-01-13 22:24

    Try

    $("#selme").change(function(){
        $(this).find("option:selected").text();
    });
    

    See a working demo

    0 讨论(0)
  • 2021-01-13 22:27

    Check it Out-->

    For getting text

    $("#selme").change(function(){
     $(this[this.selectedIndex]).text();
    });
    

    For getting value

    $("#selme").change(function(){
     $(this[this.selectedIndex]).val();
    });
    
    0 讨论(0)
  • 2021-01-13 22:28

    http://groups.google.com/group/jquery-en/browse_thread/thread/2970457bc8ec7ec5?pli=1

    All there for you

    0 讨论(0)
  • 2021-01-13 22:31

    Try this..

    $('#selme option:selected').text();

    0 讨论(0)
  • 2021-01-13 22:33

    Here is a jsfiddle for you I just made http://jsfiddle.net/AqmZp/

    Basically it actually is just $("#selme").val();

    0 讨论(0)
  • 提交回复
    热议问题