Created
April 21, 2014 15:06
-
-
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
This file contains hidden or 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
(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