Reputation: 83
I have a dropdown which i am trying to populate from the javascript. But i am unable to do it.
This is my HTML
<div class="ui fluid search selection dropdown values">
<input type="hidden" name="values" selectOnBlur={false}>
<i class="dropdown icon"></i>
<div class="default text">Select a category</div>
<div class="menu">
</div>
</div>
And this is the JS
$('.ui.dropdown.values').dropdown({values:[{name:"oi",value:32},{name:"yo",value:2}]})
Please find the codepen link below CodePen
Thanks
Upvotes: 1
Views: 287
Reputation: 574
Can be fixed by changing versions to:
https://code.jquery.com/jquery-3.2.1.min.js https://cdn.jsdelivr.net/npm/[email protected]/dist/semantic.min.js
Because the dropdown library's version you used didn't support populating via JS (as per docs)
Upvotes: 1