-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to initiate dynamically added elements such as floating label inputs #134
Comments
Helllo @omicr0n, Thank you for your interest in working with our products and also we appreciate your help in solving this issue. All the best, |
This is amazing! Thank you @omicr0n for this solution. I'm busy building an application where I need to create some form fields dynamically; noticed that the floating label was no longer working on the added fields. Your solution fixed the problem for me! Yay! |
Hi @omicr0n @groovemen, Greetings. I've tried this solution on dynamically added elements of toggle button and checkbox and unfortunately it did not work. Have You tested it on toggle button and checkbox? Any suggestion to make it work? |
I have found the solution, for me I should be using $.material.init(); instead of .bootstrapMaterialDesign(); |
@omicr0n it will not works in all situation. instead of calling
|
So I was just getting ready to ask how you do this then all of a sudden it dawned on me what to try and it worked so figured I'd still post in here in case someone else is looking for the solution to this problem since it doesn't appear to be in here anywhere and I couldn't find anything about it anywhere in the docs less I missed that memo.
But when injecting elements specifically to what this script styles such as the floating label technique and methods used to give inputs there "material" design if you inject your elements after
$('body').bootstrapMaterialDesign();
then the input label won't float when you click it to make active and start typing and will just overlay on top of what your typing.I tried calling
$('body').bootstrapMaterialDesign();
again after injecting my elements on the page but that didn't change anything. After digging around and getting ready to ask how you handle this case that's when I noticed the 'body' selector this method is being called on so tried calling.bootstrapMaterialDesign();
on my new element(s) specifically and BAM they started functioning properly as floating label inputs.Example
So yeah... I don't know if this is all documented somewhere and/or the use of
.bootstrapMaterialDesign();
or if that info is reserved for the pro version but there you go.The text was updated successfully, but these errors were encountered: