简体   繁体   English

icCube下拉小部件-如何获取所选项目?

[英]icCube drop-down widget - How to get Selected Item?

I want to get selected items from iccube-dropdown-widget with javascript. 我想使用iccube-dropdown-widget获取选定的项目。 Drop-down-widget has Div-ID 'icCubeDropDown'. 下拉小部件具有Div-ID'icCubeDropDown'。

var t = window.document.getElementById(‘icCubeDropDown’);  

doesn't work, t is Null. 不起作用,t为Null。 How can I do this? 我怎样才能做到这一点?

Thanks in advance! 提前致谢!

EDIT 编辑

var text = $("#w8 select.icCubeDropDown").children("option").filter(":selected").text(); var text is empty. var文字为空。 What is wrong? 怎么了?

Here is my report code: 这是我的报告代码:

my report code 我的报告代码

You're mixing class with id, 'icCubeDropDown' is a class. 您正在将类与ID混合在一起,“ icCubeDropDown”是一个类。 Id's in icCube are more like 'ic3-131'. icCube中的ID更像是“ ic3-131”。

I'd be using jquery selectors 我会使用jQuery 选择器

var select = $("#ic3-131 select.icCubeDropDown")

this finds the element with id ic3-131 and a select descendant. 这会找到ID为ic3-131的元素和一个select后代。

hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM