mdb-select disabled cannot be added with jquery


Topic: mdb-select "disabled" cannot be added with jquery

lmcosorio asked 3 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.


lmcosorio commented 3 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);


Mateusz Łubianka staff answered 3 years ago

Hi,

If you want to use your ID, check out my snippet: https://mdbootstrap.com/snippets/jQuery/mateusz-lubianka/1489225

Best,


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.8.10
  • Device: Laptop
  • Browser: Firefox
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No