Jquery得到select option 选中的text值

xiaoxiao2022-06-11  29

虽然可以使用以下js来得到textdocument.getElementById("lnkId").options[document.getElementById("lnkId").selectedIndex].text但是总觉得烦,不爽,还是用jquery吧

jquery是1.2.6版本的,可能版本低会有影响。<select name="lnkId" id="lnkId" style="width:100px;">                            <option value="">-选择联系人-</option>                            <option value="">-asdfwef-</option><option value="">-asdfasdf-</option><option value="">-选asdfas择efasdfasdf联系人-</option>                        </select>使用这一句就好了alert($("#lnkId>option:selected").get(0).text);

 

 

 

转载请注明原文地址: https://www.6miu.com/read-4930427.html

最新回复(0)