Materialize: Input label overlaps if value='exits'

Created on 13 Feb 2015  Â·  10Comments  Â·  Source: Dogfalo/materialize

If this is defined:

      <div class="input-field">
        <input id="name" name="name" type="text" class="validate" value='exits'>
        <label for="name">Name</label>
      </div>

you get this:
my_bus_app

Most helpful comment

You can solve this in angular with a ng-class directive like:

<label for="ctrl.foo" ng-class="{ active: ctrl.foo }">Foo title</label>
<input type="text" ng-model="ctrl.foo" class="form-control" id="foo" />

All 10 comments

This doesn't happen for me when I used your HTML code. It will only happen if you are using Angular or something similar.

i have this problem when set the input value using jquery and the input is hidden or never before has focused

Just add the class active to the label
On Feb 20, 2015 12:59 AM, "bromanv" [email protected] wrote:

i have this problem when set the input value using jquery and the input is
hidden or never before has focused

—
Reply to this email directly or view it on GitHub
https://github.com/Dogfalo/materialize/issues/682#issuecomment-75193577.

Setting the active class to the input doesn't seem to fix the issue. I'm using AngularJS but I'm setting the value via jQuery.

To the <label>

Oh yes sorry. I'm actually doing it with
$(input).focus() and then $(input).blur(), I'll try with the class when I can.

@Havock94 , you could do it with $(input).change() as the source code has told us how it change the style. :)

You can solve this in angular with a ng-class directive like:

<label for="ctrl.foo" ng-class="{ active: ctrl.foo }">Foo title</label>
<input type="text" ng-model="ctrl.foo" class="form-control" id="foo" />

Use
$("#inputId").select();

@XcodeJunkie

Working for me

Was this page helpful?
0 / 5 - 0 ratings