/ Published in: jQuery
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.. });
if ( $("#myID").onpage() ) { $("#myID img").click(function(){ //do this..here.. });
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// 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);