Topic: mdb-select "disabled" cannot be added with jquery
lmcosorio free asked 5 years ago
Not able to add attribute "disabled" to <select class="mdb-select md-form" id="myid"></select>
with jquery $('#myid').prop('disabled', true);
What I have tried:
$("#myid").attr("disabled");
And similar solutions.
By the way works perfectly with <select class="browser-default custom-select" id="myid"></select>
Any help appreciated.
Thank you.
Mateusz Łubianka staff answered 5 years ago
Hi,
If you want to use your ID, check out my snippet: https://mdbootstrap.com/snippets/jQuery/mateusz-lubianka/1489225
Best,
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: MDB jQuery
- MDB Version: 4.8.10
- Device: Laptop
- Browser: Firefox
- OS: Windows 10
- Provided sample code: Yes
- Provided link: No
lmcosorio free commented 5 years ago
I have found some sort of solution. As mdb-select structure is different, you have to target input inside the div. For example: $('div.select-wrapper.mdb-select.md-form input').prop('disabled', true);