jquery - how can I consider $(this)? -


this question has answer here:

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

Popular posts from this blog

'hasOwnProperty' in javascript -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

How to understand 2 main() functions after using uftrace to profile the C++ program? -