Topic: Material Select Set selected value
hetal free asked 8 years ago
Rafael Pujol free answered 6 years ago
var element = $("#youselectId")
element.prevAll('.select-dropdown').children('li:eq(2)').trigger('click');
you can remplace the number 2 with the item id that you want select
var changeSelectPickerValue = function (id, value) {
var element = $("#" +id)
element.prevAll('.select-dropdown').children('li:eq('+value+')').trigger('click');
}
Furey free commented 6 years ago
$(#element_id)prevAll(‘.select-dropdown’).children(‘li:contains(‘+value+’)’).trigger(‘click’);dejan.mauer pro answered 8 years ago
<div class="col-md-4 input-field">
<select id="selectDiscount">
<option id="selectDiscountNone" selected value="None">Not specified</option>
<option id="selectDiscountMoney" value="Money">in money</option>
<option id="selectDiscountPercent"value="Percent">in percent</option>
</select>
</div>
How it is possible to select, for example, second option as with JavaScript?
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- ForumUser: Free
- Premium support: No
- Technology: General Bootstrap questions
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No