How to Change mdb-select option with jquery


Topic: How to Change mdb-select option with jquery

webdesigna pro premium asked 9 months ago

How to Change mdb-select option with jquery? I usually use: $('#mdb-select').val(valueoption).trigger('change'); but in the last versión doesn´t work.

Please help me Thanks


Krzysztof Wilk staff answered 9 months ago

Hi!

You selected material select using id ($('#material-select')), but it doesn't have id. You can try add attribute id="material-select" to your select or choose by class $(".material-select") and your solution should work :)

I made a sample snippet for you, you can check it here: https://mdbootstrap.com/snippets/jquery/krzysztof-wilk/2224428


Please insert min. 20 characters.