There is an input-control
having a label
:
<div class="input-control modern text" data-role="input">
<input name="salle_lib" id="salle_lib" type="text" maxlength="70" placeholder="libellé" data-validate-func="required" data-validate-hint="Ce champ est obligatoire"/>
<button class="button helper-button clear"><span class="mif-cross"></span></button>
<span class="label">libellé</span> // this is the label
</div>
The default behaviour of MetroCSS is that when the input-control
is clicked then the label is shown :
.input-control.text > .label {
position: absolute;
left: 0;
top: -1rem;
font-size: .875rem;
}
.input-control.modern input:focus ~ .label {
opacity: 1;
-webkit-transform: translateY(-18px);
transform: translateY(-18px);
transition: all 0.3s linear;
}
I want this label to be always shown even if the input-control is not clicked. I have tried $(".input-control.text").click();
but it didnt work ! So how to do that ?
here is jsfiddle.
Just add this css to your page
.input-control.modern input ~ .label {
opacity: 1;
transform: translateY(-18px);
transition: all 0.3s linear 0s;
}