Posted By

inreflection7 on 05/26/11


Tagged

closest find


Versions (?)

.closest and .find in jQuery


 / Published in: jQuery
 

.closest and .find are very useful - surprised I haven't heard of them before.

  1. // Expand Tables
  2. $(".expandTable").toggle(
  3. function(){
  4. $(this).closest('.tableSection').find('.tradeTable').fadeIn();
  5. $(this).closest('.tableSection').find('.arrow').html('↓');
  6. },
  7. function(){
  8. $(this).closest('.tableSection').find('.tradeTable').fadeOut();
  9. $(this).closest('.tableSection').find('.arrow').html('→');
  10. }
  11. );

Report this snippet  

You need to login to post a comment.