Skip to content

Instantly share code, notes, and snippets.

@welingtonsampaio
Created August 22, 2013 12:56
Show Gist options
  • Save welingtonsampaio/6306786 to your computer and use it in GitHub Desktop.
Save welingtonsampaio/6306786 to your computer and use it in GitHub Desktop.
Checks whether a selector in the document content
;;
(function($){
"use_strict"; // +_+ jshint
// Clone atual function
$.hasSelectorOld = $.hasSelector;
// the method
// @return Boolean
$.hasSelector = function(selector) {
return $(selector).length > 0;
};
// noConflict method
// @return Function
$.hasSelector.noConflict = function() {
var func;
func = $.hasSelector;
$.hasSelector = $.hasSelectorOld;
return func;
};
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment