/ Published in: jQuery
.closest and .find are very useful - surprised I haven't heard of them before.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Expand Tables $(".expandTable").toggle( function(){ $(this).closest('.tableSection').find('.tradeTable').fadeIn(); $(this).closest('.tableSection').find('.arrow').html('↓'); }, function(){ $(this).closest('.tableSection').find('.tradeTable').fadeOut(); $(this).closest('.tableSection').find('.arrow').html('→'); } );