Topic: label floating not working with value dynamically
Hi, i'm trying to use input text with label floating. When I put the mouse, it works. But if I set value with ajax, not work.
I'm tried with focus(), addClass="active", placeholder, nothing works..
What do I have to do to make it work? I've looked i the foro but I donw't find any answer..
Thanks
TomekMakowski staff answered 6 years ago
Hi
Here you have snippet: https://mdbootstrap.com/snippets/jquery/tomekmakowski/866110
Maybe you don't have PRO version of MDB and that's why it doesn't work.
Best, Tomek
hercross answered 6 years ago
Hi Tomek..
Thanks for answer.. Yes with focus works, in pro version or free, but If I two, three, hundred input when I set value with ajax, the input has focus works, the label up, but the rest, has the value, but the label is down, if I put the focus in this one, lthe label up, if I blur the focus, the label down, but the value still here..
I don't know if I explain me..
Thanks
TomekMakowski staff answered 6 years ago
Sorry but i cannot recognize your problem. Could you please describe it more clearly and add maybe some snippet project.
Best, Tomek
hercross answered 6 years ago
Yes, sure.
I have this form
Like you can see, I have 3 input, in each one I put the value with ajax, I get the value with sql, in the two first yhe label is down, and in the third, the label is up because I have the focus.
I've tried to put the focues when I add the value, but only works in the last input, the rest, the label is down.
I've tried with addClass='actived' or active.. and it doesn't works..
Any idea?
Thanks
TomekMakowski staff answered 6 years ago
But where you add class "active". I think it should work when you add class "active" into label eg.:
$(function(){
$(".md-form label").addClass("active");
});
Best, Tomek
hercross answered 6 years ago
No, it doesn't work.. The same. Only works with focus, but it's good for me when I only have one input, with several inputs it doesn't works.. only works de last input..
TomekMakowski staff answered 6 years ago
That's right
look at this snippet:
https://mdbootstrap.com/snippets/jquery/mikolaj-smolenski/893718
best, Tomek
hercross answered 6 years ago
Hi Tomek.. Thanks for all, but it doesn't works. I''d tried like in the snippet, but the same. when I set a dynamic value, nçthe label doesn't up. But If I put the mouse, the label up..
Any other idea?
Thanks
TomekMakowski staff answered 6 years ago
In the snippet everything is OK and our select works properly. I'm sorry but unfortunately i can't recognize your problem
Mousa pro answered 5 years ago
anilbaggio answered 4 years ago
Hi, Add class "bmd-form-group is-filled" to your div that contains the form-group and to the input element directly which will work.
Marcin Luczak staff commented 4 years ago
Hi @anilbaggio,
Thank you for your answer :)
Keep coding, Marcin from MDB
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Free
- Premium support: No
- Technology: MDB jQuery
- MDB Version: 4.8.4
- Device: Laptop
- Browser: firefox
- OS: windows 10
- Provided sample code: No
- Provided link: No