Topic: Problem with dynamic input fields labels initialization inside modal.
alejandro-serranomarmetic-com free asked 3 years ago
Hello,
I have a problem with dynamic input fields labels initialization inside a modal form loaded by ajax.
I have tried to initialize the inputs and update labels width after get the code from ajax call, and even when the modal window is shown, but it doesn't update the labels width.
I'm using this code to update the width:
document.querySelectorAll('.form-outline').forEach((formOutline) => { new mdb.Input(formOutline).init(); });
(I have tried with the update function too).
And I have tried this same code in the shown event of the modal too, but the label width doesn't update.
Besides, outside the modal I haven't got any problem. It works perfect. Only fails inside modal window.
Can someone help me, please?
Thank you.
Wojciech Staniszewski staff answered 3 years ago
We prepared a snippet here: https://mdbootstrap.com/snippets/standard/grzegorz-bujanski/2862487#js-tab-view. Please check if that is what you meant and if the problem still occurs in your code, create a snippet.
alejandro-serranomarmetic-com free commented 3 years ago
Thank you my friend! Now it's working fine.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Resolved
- ForumUser: Free
- Premium support: No
- Technology: MDB Standard
- MDB Version: 3.2.0
- Device: Any
- Browser: Any
- OS: Any
- Provided sample code: No
- Provided link: No