Skip to content

Instantly share code, notes, and snippets.

@aghecht
Created August 30, 2011 15:35
Show Gist options
  • Save aghecht/1181187 to your computer and use it in GitHub Desktop.
Save aghecht/1181187 to your computer and use it in GitHub Desktop.
Sample jQuery organization using JavaScript objects
var BackButton = {
init: function() {
if (this.sampleFunction()) {
$('.backbutton').click(this.backButtonEvent);
}
},
sampleFunction: function() {
return true;
},
backButtonEvent: function() {
history.go(-1);
}
};
$(document).ready(function() {
BackButton.init();
AnotherObject.init();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment