Initialize input fields loaded with Ajax


Topic: Initialize input fields loaded with Ajax

Beedge pro asked 7 years ago

I have a form that is loaded into a tab via ajax.

If the form is pre-populated from the database the labels obscure the inputs

What it the correct way to trigger the labels? I have read that I need to add the 'active' class to the labels on fields that contain data. Is this the only way? or can I have some javascript call execute when tab is loaded?


Gustavo Ramón commented 7 years ago

Same problem!!!

Hi, The easiest way is when you add the active class to the labels on fields that contain data. Regards,

Gustavo Ramón commented 7 years ago

Solved! //input field receive value $("#input-field").val("value"); $("#input-field").trigger("focusin"); $("#input-field").trigger("blur");

FREE CONSULTATION

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

Status

Closed

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No