Created
November 24, 2011 14:52
-
-
Save marekkalnik/1391507 to your computer and use it in GitHub Desktop.
jQuery chaining and code scoping
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
var formHandling = function(formSelector) { | |
var onFormSubmit, onButtonClick, onQuantityChange; | |
jQuery(formSelector).bind('submit', onFormSubmit).end() | |
.find('button').bind('click', onButtonClick).end() | |
.find('input[name="quantity"]').bind('change', onQuantityChange); | |
onFormSubmit = function() { ... }; | |
onButtonClick = function() { ... }; | |
onQuantityChange = function() { ... }; | |
} | |
formHandling(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment