jQuery plugin - onpage - checks for selector on current page


/ Published in: jQuery
Save to your folder(s)

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.. });


Copy this code and paste it in your HTML
  1. // function as jquery plugin to test if selector is found on the current page
  2. (function($){ $.fn.onpage = function() { return ($(this).length>0) ? true : false } })(jQuery);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.