Search code examples
javascripticcubeiccube-reporting

icCube drop-down widget - How to get Selected Item?


I want to get selected items from iccube-dropdown-widget with javascript. Drop-down-widget has Div-ID ‘icCubeDropDown’.

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

doesn’t work, t is Null. How can I do this?

Thanks in advance!

EDIT

var text = $("#w8 select.icCubeDropDown").children("option").filter(":selected").text(); var text is empty. What is wrong?

Here is my report code:

my report code


Solution

  • You're mixing class with id, 'icCubeDropDown' is a class. Id's in icCube are more like 'ic3-131'.

    I'd be using jquery selectors

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

    this finds the element with id ic3-131 and a select descendant.

    hope it helps