Last active
December 11, 2015 22:08
-
-
Save robotmay/4666976 to your computer and use it in GitHub Desktop.
Rig checkboxes to look like links, because so many designers seem to want this lately. Adds a 'checked' class to the checkbox label and hides the input.
This file contains hidden or 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
switchLabelClass = (el) -> | |
if $(el).attr("checked") == "checked" | |
$(el).parent().addClass("checked") | |
else | |
$(el).parent().removeClass("checked") | |
# Obviously change the form target here | |
checkbox_groups = $("form").find("input[type = 'checkbox']").each -> | |
$(this).hide() | |
switchLabelClass(this) | |
$(this).change => | |
switchLabelClass(this) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment