Skip to content

Instantly share code, notes, and snippets.

@cdl
Created October 9, 2013 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cdl/6905496 to your computer and use it in GitHub Desktop.
Save cdl/6905496 to your computer and use it in GitHub Desktop.
(function($) {
$.fn.shush = function(btnSelector) {
// First, validation
// validate button selector
if (!btnSelector instanceof jQuery) {
// button selector is not jQuery object
throw "Expected button selector to be type 'jQuery', got + " typeof(btnSelector);
return false;
}
// Cache global variables
var $form = $(this);
var $button = $form.children("input[type=submit]")[0];
if (btnSelector)
$button = $form.children(btnSelector[0]);
var $buttonType = $button[0].nodeName.toLowerCase();
}
}(jQuery));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment