码上敲享录 > js常见问题解答 > 如何获取select选中option的文本?

如何获取select选中option的文本?

上一章章节目录下一章 2018-08-21已有2745人阅读 评论(0)

如何获取select选中option的文本?


解决方法:

sc_id代表select标签的id

var select=document.getElementById("sc_id");//或者$("#sc_id").get(0)

alert(select.options[select.options.selectedIndex].text);


还有一种方法,showdiv是js方法:

<select id="sc_id" onchange="showdiv(this.options[this.options.selectedIndex].text);" ></select>


本文链接:http://www.yayihouse.com/yayishuwu/chapter/1515


向大家推荐《Activiti工作流实战教程》:https://xiaozhuanlan.com/activiti
0

有建议,请留言!

  • *您的姓名:

  • *所在城市:

  • *您的联系电话:

    *您的QQ:

  • 咨询问题:

  • 提 交