Created
November 7, 2018 19:27
-
-
Save AndreFSilveira/9d2425405e9520fb079eea5e318007f4 to your computer and use it in GitHub Desktop.
Remove duplicate toggle and checkbox with materialize. add this code before $.material.init();
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
$.material.togglebutton = function(selector) { | |
// Add fake-checkbox to material checkboxes | |
$((selector) ? selector : this.options.togglebuttonElements) | |
.filter(":notmdproc") | |
.filter(function(){ //added this filter to skip checkboxes that were already initialized | |
return $(this).parent().find(".toggle").length === 0; | |
}) | |
.data("mdproc", true) | |
.after("<span class=toggle></span>"); | |
}; | |
$.material.checkbox = function(selector) { | |
// Add fake-checkbox to material checkboxes | |
$((selector) ? selector : this.options.checkboxElements) | |
.filter(":notmdproc") | |
.filter(function(){ //added this filter to skip checkboxes that were already initialized | |
return $(this).parent().find(".check").length === 0; | |
}) | |
.data("mdproc", true) | |
.after("<span class=check></span>"); | |
}; | |
... | |
$.material.init(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment