Topic: label floating not working with value dynamically

hercross free asked 4 years ago


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


anilbaggio free answered 2 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 2 years ago

Hi @anilbaggio,

Thank you for your answer :)

Keep coding, Marcin from MDB


Mousa pro answered 4 years ago


$(inputselector).val(newvalue).trigger("change");


Tomek Makowski staff answered 4 years ago


In the snippet everything is OK and our select works properly. I'm sorry but unfortunately i can't recognize your problem


hercross free answered 4 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


Tomek Makowski staff answered 4 years ago


That's right

look at this snippet:

https://mdbootstrap.com/snippets/jquery/mikolaj-smolenski/893718

best, Tomek


hercross free answered 4 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..


Tomek Makowski staff answered 4 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 free answered 4 years ago


Yes, sure.

I have this form

enter image description here

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


Tomek Makowski staff answered 4 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 free answered 4 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


Tomek Makowski staff answered 4 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



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: 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