limit the use of a function in jQuery by targeting a class or id

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

Copy this code and paste it in your HTML
  1. $(document).ready(function(){
  2. if ($(".target").length) {
  3. //function code
  4. }
  5. });

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.