Dynamically addClass to Target ID or Class or Div

$("#idName").each(function(i) { $(this).addClass("item" + (i+1)); }); $(".className").each(function(i) { $(this).addClass("item" + (i+1)); }); $("div").each(function(i) { $(this).addClass("item" + (i+1)); });
Dynamically addClass to Target ID or Class or Div

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.