Standardized hints while providing backwards compatibility on data-hint

This commit is contained in:
Kevin Ross 2015-11-06 10:34:41 -06:00
parent 59811e4ca5
commit e8bb88c79c
2 changed files with 7 additions and 6 deletions

View File

@ -506,7 +506,7 @@
</div>
<div class="form-group">
<input type="text" class="form-control floating-label" placeholder="old floating label" data-hint="old hint attribute">
<input type="text" class="form-control floating-label" placeholder="old floating label" data-hint="This is a hint using a <code>data-hint</code> attribute on the input">
</div>
<h2>Textarea</h2>

View File

@ -78,9 +78,9 @@
console.error("Expected form-group for input", $this);
}
if (!$this.attr("data-hint") && !$this.hasClass("floating-label")) {
return;
}
//if (!$this.attr("data-hint") && !$this.hasClass("floating-label")) {
// return;
//}
$this.after("<span class=material-input></span>");
@ -91,9 +91,10 @@
$this.after("<div class=floating-label>" + placeholder + "</div>");
}
// Add hint label if required
// Add hint label if using the shorthand data-hint attribute on the input
if ($this.attr("data-hint")) {
$this.after("<div class=hint>" + $this.attr("data-hint") + "</div>");
$this.after("<p class='help-block hint'>" + $this.attr("data-hint") + "</p>");
}
// Set as empty if is empty (damn I must improve this...)