diff --git a/scripts/material.js b/scripts/material.js
index c5653288..e5b60682 100644
--- a/scripts/material.js
+++ b/scripts/material.js
@@ -4,32 +4,37 @@ $(function (){
ripples.init(".btn:not(.btn-link), .navbar a, .nav-tabs a, .withripple");
- // Add fake-checkbox to material checkboxes
- $(".checkbox > label > input").after("");
+ $(document).bind("DOMSubtreeModified", function(){
+ // Add fake-checkbox to material checkboxes
+ $(".checkbox > label > input").not(".bs-material").addClass("bs-material").after("");
- // Add fake-radio to material radios
- $(".radio > label > input").after("");
+ // Add fake-radio to material radios
+ $(".radio > label > input").not(".bs-material").addClass("bs-material").after("");
- // Add elements for material inputs
- $("input.form-control, textarea.form-control, select.form-control").each( function() {
- $(this).wrap("
");
- $(this).after("");
- if ($(this).hasClass("floating-label")) {
- var placeholder = $(this).attr("placeholder");
- $(this).attr("placeholder", null).removeClass("floating-label");
- $(this).after("" + placeholder + "
");
- }
- if ($(this).is(":empty") || $(this).val() === null || $(this).val() == "undefined" || $(this).val() === "") {
- $(this).addClass("empty");
- }
+ // Add elements for material inputs
+ $("input.form-control, textarea.form-control, select.form-control").not(".bs-material").each( function() {
+ $(this).addClass("bs-material");
+ $(this).wrap("");
+ $(this).after("");
+ if ($(this).hasClass("floating-label")) {
+ var placeholder = $(this).attr("placeholder");
+ $(this).attr("placeholder", null).removeClass("floating-label");
+ $(this).after("" + placeholder + "
");
+ }
+ if ($(this).is(":empty") || $(this).val() === null || $(this).val() == "undefined" || $(this).val() === "") {
+ $(this).addClass("empty");
+ }
+
+ if ($(this).parent().next().is("[type=file]")) {
+ $(this).parent().addClass("fileinput");
+ var $input = $(this).parent().next().detach();
+ $(this).after($input);
+ }
+ });
- if ($(this).parent().next().is("[type=file]")) {
- $(this).parent().addClass("fileinput");
- var $input = $(this).parent().next().detach();
- $(this).after($input);
- }
});
+
$(document).on("keyup change", ".form-control", function() {
var self = $(this);
setTimeout(function() {