Skip to content

Instantly share code, notes, and snippets.

View marekkalnik's full-sized avatar
😁

Marek Kalnik marekkalnik

😁
View GitHub Profile
@marekkalnik
marekkalnik / gist:1391507
Created November 24, 2011 14:52
jQuery chaining and code scoping
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() { ... };