added support for dynamically added inputs

This commit is contained in:
Federico Zivolo 2014-09-23 10:28:01 +02:00
parent f76e82f78b
commit 87a3791071

View File

@ -4,14 +4,16 @@ $(function (){
ripples.init(".btn:not(.btn-link), .navbar a, .nav-tabs a, .withripple");
$(document).bind("DOMSubtreeModified", function(){
// Add fake-checkbox to material checkboxes
$(".checkbox > label > input").after("<span class=check></span>");
$(".checkbox > label > input").not(".bs-material").addClass("bs-material").after("<span class=check></span>");
// Add fake-radio to material radios
$(".radio > label > input").after("<span class=circle></span><span class=check></span>");
$(".radio > label > input").not(".bs-material").addClass("bs-material").after("<span class=circle></span><span class=check></span>");
// Add elements for material inputs
$("input.form-control, textarea.form-control, select.form-control").each( function() {
$("input.form-control, textarea.form-control, select.form-control").not(".bs-material").each( function() {
$(this).addClass("bs-material");
$(this).wrap("<div class=form-control-wrapper></div>");
$(this).after("<span class=material-input></span>");
if ($(this).hasClass("floating-label")) {
@ -30,6 +32,9 @@ $(function (){
}
});
});
$(document).on("keyup change", ".form-control", function() {
var self = $(this);
setTimeout(function() {