Created
October 9, 2013 18:02
-
-
Save cdl/6905496 to your computer and use it in GitHub Desktop.
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($) { | |
$.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