Skip to content

Instantly share code, notes, and snippets.

@patrickgombert
Created January 13, 2012 04:14
Show Gist options
  • Save patrickgombert/1604655 to your computer and use it in GitHub Desktop.
Save patrickgombert/1604655 to your computer and use it in GitHub Desktop.
Better Javasript
var Visibility {
init : function() {
$("#some_button").bind('click', hider);
$("#some_other_button").bind('click', shower);
}
hider : function() {
$("#some_div").hide();
}
shower : function() {
$("#some_div").show();
}
}
var ColumnReporter {
init : function() {
$("form").bind('submit', $("#feedback").html(total_column()));
}
total_column : function() {
var total = 0;
(".important_column").children().each(function() {
total += this.val();
}
return total;
}
}
$(function() {
Visibility.init();
ColumnReporter.init();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment