Created
October 9, 2013 18:08
-
-
Save cdl/6905555 to your computer and use it in GitHub Desktop.
This file contains 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) { | |
// Cache global variables | |
var $form = $(this); | |
var $button = $form.children("input[type=submit]")[0]; | |
if (btnSelector instanceof jQuery) { | |
$button = $form.children(btnSelector[0]); | |
} else if (typeof(btnSelector) == 'string') { | |
$button = $.find(btnSelector)[0]; | |
} | |
// 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; | |
} | |
} | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment