How to Change mdb-select option with jquery


Topic: How to Change mdb-select option with jquery

webdesigna asked 5 years 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 5 years 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.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.19.0
  • Device: all
  • Browser: all
  • OS: Mac
  • Provided sample code: No
  • Provided link: No