jquery - how can I consider $(this)? -
this question has answer here:
- jquery: “$(this)” mean? 6 answers
hello have doubt $(this) in jquery. doing exercise, @ end of script can see:
$(this).before(quote); can consider $(this) temporary variable contains value of loop? in how can consider $(this)?
$(document).ready(function() { $('span.pq').each(function() { var quote = $(this).clone(); quote.removeclass('pq'); quote.addclass('pullquote'); $(this).before(quote); }); //end each }); // end ready
$('span.pq') return list of elements array of elements. $(this) element of $('span.pq') array of elements.
$(this) equal $('span.pq')[index] // index variable of each loop.
Comments
Post a Comment