Topic: How to set the multiselect's value by js?
Expected behavior
when I have do some select in a multiSelect, I save the value to the db, then I close the tab. Next time I open the multiselect, I want some options in the select remain checked.
Actual behavior
Resources (screenshots, code snippets etc.)
I tried like this (worked in a normal select):
$("#someMultiSelect")
.find("option:contains('" + savedValue + "')")
.attr("selected", "selected");
It doesn't work.
MDBootstrap staff pro premium priority answered 5 years ago
Hi herrshi,
I created snippet with example for you: https://mdbootstrap.com/snippets/jquery/pjoter-2-0/958370
If you need additional help I am here for you.
Best Regards, Piotr
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.8.5
- Device: pc
- Browser: chrome
- OS: windows 10
- Provided sample code: No
- Provided link: No