Topic: How to make the style of the label according to the input working if you set the text input value dynamically

Manuel Dupont free asked 3 years ago

When setting the input values dynamically, the forms doesnt apply the style. As per say the labels are over the input text cause I think no user interaction has happened so the label (that shoul go on top of the text input, is not done correctly.

How do you achieve this ?!

see this screencast ...

As you can see, the input text are over the labels. or vice versa.

Jakub Strebeyko staff answered 3 years ago

Hi there @Manuel Dupont,

Thanks for reaching out! Yes - as of now, changing the value programmatically does not trigger .active label class insertion.

The functionality can be implemented by simply calling .focus() on inputs in question as part of your fetching / filling script. Once it's called and the values are in, label shall remain .active and no overlapping will take place.

Let me know whether that helped.

Best, Kuba

Please insert min. 20 characters.


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



Specification of the issue

  • User: Free
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: Macbook
  • Browser: Chrome
  • OS: Mojave
  • Provided sample code: No
  • Provided link: Yes