如何获得选定的选项ID? [英] How to get selected option ID?
本文介绍了如何获得选定的选项ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
从HTML中获取所选值select:
to get the selected value from HTML select:
options [selectedIndex] .value
如果我想在选定的选项上获得id
?
what if i want to get the "id"
on the selected option?
推荐答案
这很简单:
It's as simple as:
options[selectedIndex].id
这篇关于如何获得选定的选项ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文