How to get value of dropdown menu in semantic ui?

Shravan Kumar picture Shravan Kumar · May 31, 2016 · Viewed 20.7k times · Source

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>

Answer

Nicolasie picture Nicolasie · Jun 2, 2016

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