Skip to content

Instantly share code, notes, and snippets.

@iacutone
Created August 16, 2013 01:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iacutone/c28e8fa1324f82b508e0 to your computer and use it in GitHub Desktop.
Save iacutone/c28e8fa1324f82b508e0 to your computer and use it in GitHub Desktop.
add and remove checkboxes with CoffeScript
$('form').on 'click', '.checker', (event) ->
boxes = $(":checkbox:checked")
nboxes = $(":checkbox:not(:checked)")
if boxes.length == 1
$('.checker_label').hide()
nboxes.hide()
if boxes.length == 0
$('.checker_label').show()
nboxes.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment