How to get value of dropdown menu in semantic ui?
Asked Answered
S

3

11

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>
Sorosis answered 31/5, 2016 at 16:9 Comment(0)
H
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

Hembree answered 2/6, 2016 at 17:23 Comment(1)
@nicolasie how do I get this information by documentation I am new to web development, any help would be very much appreciatedMethacrylate
T
2

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

Trisyllable answered 15/9, 2016 at 0:37 Comment(0)
R
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(){

});
Rosner answered 31/1, 2019 at 5:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.