Topic: How to hide Select after initialization
Jordan Mack pro asked 1 year ago
*Expected behavior*Select element does not show on page
*Actual behavior*Select element shows on page
Resources (screenshots, code snippets etc.)
I also have jQuery at my disposal so if you have any solutions using that as well that would be great.
I have a select element on my page:
<select name="customerid" id="customerid" data-mdb-filter="true" class="select defOff" id="customer" hidden> <option disabled selected>-- Customer</option> </select>
as you can see the hidden attribute is applied but I suspect when
.hide() but it doesn't seem to work either.
In my jquery document ready event I have this:
const customerSelect = mdb.Select.getInstance(document.getElementById('customerid')); console.log(customerSelect);
Michał Duszak staff answered 1 year ago
You can wrap this Select in a
.hidden class, as Select itself gets re-rendered, it will still inherit
display: none; style.
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Pro
- Premium support: No
- Technology: MDB Standard
- MDB Version: MDB5 3.8.0
- Device: Intel x86
- Browser: Chrome
- OS: Ubuntu 20.04
- Provided sample code: Yes
- Provided link: No