Skip to content

Instantly share code, notes, and snippets.

@grayghostvisuals
Created April 21, 2014 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grayghostvisuals/11145313 to your computer and use it in GitHub Desktop.
Save grayghostvisuals/11145313 to your computer and use it in GitHub Desktop.
Self-Executing Anonymous Functions or How to Write Clean Javascript :: http://esbueno.noahstokes.com/post/77292606977/self-executing-anonymous-functions-or-how-to-write
(function() {
var Person = {
init: function() {
this.form = $('#form');
this.bindEvents();
},
bindEvents: function() {
this.form.on('submit', this.showName);
},
showName: function(event) {
event.preventDefault();
alert(this.form.find('input[type=text]').val());
}
}
Person.init();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment