Enab
Enab

Reputation: 41

get/retrieve the value/data-attribute of the selected option from dropdown in office ui fabric core

I am adding the option list using jquery to my drop-down and my option looks like this


    <option value="7f8a19e6-18b8-47e4-b60f-bd8a4880a224">10-city health club</option>

I want to retrieve the "value" of the option that I have selected from the drop-down.

the selected option and the list look like this:

<span class="ms-Dropdown-title">abc</span>

<ul class="ms-Dropdown-items">
<li class="ms-Dropdown-item">Select Project</li>
<li class="ms-Dropdown-item">abc</li>
<li class="ms-Dropdown-item">10-city health club</li>
</ul>

Upvotes: 0

Views: 127

Answers (1)

Enab
Enab

Reputation: 41

we can get the selected option value as

 var id = $('#idOfTheSelectTag :selected').attr('value');

Upvotes: 1

Related Questions