Topic: Disable floating label on input field without placeholder

ljacobsen free asked 6 years ago


This code creates an input field with a floating label. If the input field has a value, or if the user clicks to enter a value, the label moves up to accommodate the input value.

If there is no value in the input field, the label will stay low.

<div class="md-form">
 <input class="form-control" id="PublicationNumber" name="PublicationNumber" type="text" value="" />
 <label for="PublicationNumber">Publication Number</label>
</div>

This code creates an input field with a floating label. If the input field has a value, or if the user clicks to enter a value, the label moves up to accommodate the input value.

The moving labels are distracting. Also, they create alignment problems on forms where some fields have values and other fields have no values.

I want to disable the floating labels without using a placeholder text in the input field. The label should always be above the input field.

The solution at https://mdbootstrap.com/support/disable-label-floating/ is not satisfactory because it requires a placeholder value. I want to completely disable the floating label.


Marta Wierzbicka staff answered 6 years ago


Hi, add to the <input> an autofocus attribute. Best, Marta

manimurugan free commented 6 years ago

place holder floating not working in angular 5

Jakub Strebeyko staff commented 6 years ago

To find answers for Angular-related questions please refer to a relevant support forum category. @manimurugan


Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags