Get the value of select tag jQuery

This question already has an answer here:

  • Get selected text from a drop-down list (select box) using jQuery 29 answers

  • Please use this one :

    If you want to get text value : like Cool and Hot then ues this one

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

    If you want to get value : like 1,2 then

    $('#sel1 option:selected').val();
    

    Through .val() you will receive the value of the value attribute. You can fetch the text through .text() .

    Use this method on your selected option! See this answer!


    Use option:selected

    querySource = $("#querySource option:selected").text();
    

    Also you may use the followings

    $("#querySource option").is("selected").text()
    $("#querySource").children("option").is("selected").text()
    
    链接地址: http://www.djcxy.com/p/83116.html

    上一篇: 选择标签中的jQuery提示文本

    下一篇: 获取选择标记jQuery的值