search

Home  >  Q&A  >  body text

easyUI and jquery selector - Stack Overflow

            <p class="fitem">
                <label class="formalg">设备名称:</label>
                <select class="easyui-combobox" name='deviceId' style="width:100px;">
                    <option value="4100001">入口</option>
                </select>
            </p>

Just such a p, I want to get the text of the select option, which is the entrance.
$(":selected").text() and $("select").find("option:selected").text(); will not work, Because there are multiple selection boxes, $("select[name='deviceId']").find("option:selected").text(); returns an empty string.
EasyUI has changed the dom tree, it seems that it can only add an id.

阿神阿神2796 days ago586

reply all(3)I'll reply

  • 为情所困

    为情所困2017-05-19 10:33:21

    $("opption[value='4100001']").val();

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-19 10:33:21

    Get the text selected by select:

    $(".easyui-combobox").find("option:selected").text();

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-19 10:33:21

    $("select[name='deviceId']").val();

    reply
    0
  • Cancelreply