获取所选的< select>元素在飞镖
问题描述:
我如何获得元素的选择选项?
document.query(#id) - 返回没有值属性的元素
所以我不能这样做:
how i can obtain selected option of element? document.query("#id") - returns Element which hasn't value propery so i can't do:
var val = document.query("#id").value;
var val = (SelectElement)(document.query("#id")).value; // - "SelectElement is class and cannot be used as an expression"
如何进行类型转换
答
只需要
String str = document.query("#idOfSelect").value;
将被警告,但您可以忽略它
will be warning, but you can ignore it