Topic: How do I reset the position of the floating label of a standard Input when emptying it with JavaScript?
Expected behavior
I have an input with a floating label (see snippet). I want to set the value back to null with Javascript. If i do so using document.getElementById().value, it doesn't reset the label position back to inside the component. I thought I could fix this by using the private Autocomplete._updateLabelPosition(); function that Kamila mentioned a week or so ago, but apparently a standard Input doesn't have that function (as can be seen by clicking the second button).
How do I reset this label position for an Input?
Resources (screenshots, code snippets etc.)
https://mdbootstrap.com/snippets/standard/ikan_nak/6307580#js-tab-view
ikan_nak pro premium priority answered 8 hours ago
While debugging the Javascript code, I found the "forceInactive" function on the Input element that does what I'm looking for.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 7.2.0
- Device: Desktop computer
- Browser: Edge
- OS: Windows 11
- Provided sample code: No
- Provided link: Yes