Topic: Material Input visually broken after setting value with JS

badmusician free asked 4 years ago

Expected behavior

The input should look like this:

Actual behavior

The input looks like this: Label is above the text

Note: after clicking on the input, it updates and gets back to how it should look

Is there a method to manually redraw\update the visuals of the material input?

Grzegorz Bujański staff commented 4 years ago

Hi. Unfortunately, in Java Script, the val() method does not trigger any events - that's why the label does not rise up. You can call the event yourself using the trigger() method. I suggests something like $('# my-input').val('new value').trigger('change')

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

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.18.0
  • Device: PC
  • Browser: Chrome
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: No