Skip to content

Instantly share code, notes, and snippets.

@joshnabbott
Created May 9, 2012 22:33
Show Gist options
  • Select an option

  • Save joshnabbott/2649407 to your computer and use it in GitHub Desktop.

Select an option

Save joshnabbott/2649407 to your computer and use it in GitHub Desktop.
(($) ->
class CheckboxSource
constructor: (@root) ->
data: -> _.map @root.find(":checkbox:checked"), (obj) -> $(obj).val()
$ ->
$("*[data-checkbox-source]").each ->
self = $(this)
source = new CheckboxSource(self)
key = self.data("checkbox-source")
$.setGlobalId(key, source)
)(jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment