Skip to content

Instantly share code, notes, and snippets.

@the-teacher
Created April 24, 2013 08:45
Show Gist options
  • Save the-teacher/5450680 to your computer and use it in GitHub Desktop.
Save the-teacher/5450680 to your computer and use it in GitHub Desktop.
Jquery plagin template
$('selector').smartDataInputs()
(($) ->
# e.keyCode e.shiftKey e.ctrlKey e.altKey e.metaKey
# keydown => keypress => keyup
$.fn.smartDataInputs = (options) ->
block = @
inputs = block.children('input')
params = $.extend {}, options
day = $ inputs[0]
month = $ inputs[1]
year = $ inputs[2]
$(block).on 'keydown', day, (e) ->
log 'keydown'
$(block).on 'keyup', day, (e) ->
log 'keyup'
$(block).on 'keypress', day, (e) ->
log 'keypress'
@
)(jQuery)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment