Return to Snippet

Revision: 15964
at July 22, 2009 15:03 by pixelhandler


Updated Code
// function as jquery plugin to test if selector is found on the current page
(function($){ $.fn.onpage = function() { return ($(this).length>0) ? true : false } })(jQuery);

Revision: 15963
at July 21, 2009 16:30 by pixelhandler


Initial Code
// function as jquery plugin to test if selector is found on the current page
(function($){
	$.fn.onpage = function() {
		if ($(this).length>0) {
			return true
		}
		return false
	}
})(jQuery);

Initial URL

                                

Initial Description
function as jquery plugin to test if selector is found on the current page. Sample use:

if ( $("#myID").onpage() ) { $("#myID img").click(function(){ //do this..here.. });

Initial Title
jQuery plugin - onpage - checks for selector on current page

Initial Tags
plugin, function

Initial Language
jQuery