10

I have this code but I don't know how to get selected value.Where should i give id value for this list?

<div class="ui compact menu">
    <div class="ui simple dropdown item">Question
        <i class="dropdown icon"></i>
        <div id="question" class="menu">
            <div id="type" class="item" data-value="mcsc">Multiple Choice Single Correct</div>
            <div id="type" class="item" data-value="mcmc">Multiple Choice Multiple Correct</div>
            <div id="type" class="item" data-value="numerical">Numerical</div>
        </div>
    </div>
</div>
nas
  • 2,289
  • 5
  • 32
  • 67
Shravan Kumar
  • 241
  • 1
  • 3
  • 6

3 Answers3

29

You must use something like this:

$('#idDropDown').dropdown('get value');

I hope that helps you.

Docs for this can be found in last table here: https://semantic-ui.com/modules/dropdown.html#/usage

allenski
  • 1,652
  • 4
  • 23
  • 39
Nicolasie
  • 301
  • 2
  • 7
2

$('#DropDownID').find(":selected").val();

Snow
  • 1,058
  • 2
  • 19
  • 47
user3562417
  • 256
  • 2
  • 4
1

I've search for the best this one is little bit better than other functions. It 100% works in proper use.

$('#dropdown-id').dropdown('setting', 'onChange', function(){

});
Partho63
  • 3,117
  • 2
  • 21
  • 39
Musa Toktaş
  • 59
  • 1
  • 6