@@ -4,15 +4,15 @@ $(function (){
44
55 ripples . init ( ".btn:not(.btn-link), .navbar a, .nav-tabs a, .withripple" ) ;
66
7- $ ( document ) . bind ( "DOMSubtreeModified" , function ( ) {
7+ var initInputs = function ( ) {
88 // Add fake-checkbox to material checkboxes
99 $ ( ".checkbox > label > input" ) . not ( ".bs-material" ) . addClass ( "bs-material" ) . after ( "<span class=check></span>" ) ;
1010
1111 // Add fake-radio to material radios
1212 $ ( ".radio > label > input" ) . not ( ".bs-material" ) . addClass ( "bs-material" ) . after ( "<span class=circle></span><span class=check></span>" ) ;
1313
1414 // Add elements for material inputs
15- $ ( "input.form-control, textarea.form-control, select.form-control" ) . each ( function ( ) {
15+ $ ( "input.form-control, textarea.form-control, select.form-control" ) . not ( ".bs-material" ) . each ( function ( ) {
1616 if ( $ ( this ) . is ( ".bs-material" ) ) { return ; }
1717 $ ( this ) . wrap ( "<div class=form-control-wrapper></div>" ) ;
1818 $ ( this ) . after ( "<span class=material-input></span>" ) ;
@@ -32,8 +32,17 @@ $(function (){
3232 }
3333 } ) ;
3434
35- } ) . trigger ( "DOMSubtreeModified" ) ;
35+ } ;
36+ initInputs ( ) ;
3637
38+ // Support for "arrive.js" to dynamically detect creation of elements
39+ // include it before this script to take advantage of this feature
40+ // https://github.com/uzairfarooq/arrive/
41+ if ( document . arrive ) {
42+ document . arrive ( "input, textarea, select" , function ( ) {
43+ initInputs ( ) ;
44+ } ) ;
45+ }
3746
3847 $ ( document ) . on ( "keyup change" , ".form-control" , function ( ) {
3948 var self = $ ( this ) ;
@@ -67,4 +76,3 @@ $(function (){
6776 $ ( this ) . prev ( ) . val ( value ) ;
6877 } ) ;
6978} ) ;
70-
0 commit comments