[不花钱站长]:从免费域名开始[0元] Oracle永久免费VPS[0元] VPS环境搭建免费脚本[0元] 秒变大盘挂载免费网盘[0元] 小白免费采集器1天500W[0元] CF免费DNS+CDN服务[0元]
[零基础网赚]:撸本站免费源码[0元] 网站强引免费蜘蛛法[0元] 图片视频文件免费存储[0元] 外链轻松发布免费友链[0元] 入坑免费教程学习源代码[0元] 网上百种+赚钱联盟推荐[?元]

↑↑VPS推荐网 WWW.VPS.COM.IN 稳定 便宜 免备案↑↑


您现在的位置是:首页 > 全球[VPS测评] >  charset,com,doctype,head,html,jquery,js,meta,select,title,utf,ww,国外永久免费VPS

js jquery获取html select当前选中值

全球[VPS测评]来源:VPS推荐网点击:965
【性价之王】【线路之王】【价格之王】【配置之王】
【免费之王】【香港首推】【梯子之王】【独服之王】
js jquery获取html select当前选中值js获取html select当前选中值代码:

<!doctype html> <html> <head>     <meta charset="UTF-8">     <title>js获取html select当前选中值-www.02405.com</title> </head> <body> <select id="user" onchange="showSelect()">     <option value="zhangsan">张三</option>     <option value="lisi">李四</option>     <option value="wangwu">王五</option> </select> <script type="text/javascript">     function showSelect(){         var obj = document.getElementById("user");         var index = obj.selectedIndex;//当前select选中项的索引         console.log(obj.options[index].value);//输出当前select选中项的value         console.log(obj.options[index].text);//输出当前select选中项的text     } </script> </body> </html>

jquery获取html select当前选中值代码:

<!doctype html> <html> <head>     <meta charset="UTF-8">     <title>js获取html select当前选中值-www.02405.com</title>     <script src="jquery.min.js"></script> </head> <body> <select id="user" onchange="showSelect()">     <option value="zhangsan">张三</option>     <option value="lisi">李四</option>     <option value="wangwu">王五</option> </select> <script type="text/javascript">     function showSelect(){         console.log($("#user").find("option:selected").val());//输出当前select选中项的value         console.log($("#user").find("option:selected").text());//输出当前select选中项的text     } </script> </body> </html>

猜你可能想看的VPS


转载请注明原文地址:http://140.238.13.167:12355/read-157690.html

下一篇       上一篇