Skip to content

Instantly share code, notes, and snippets.

@mattradford
mattradford / jquery_div_toggle.js
Created June 8, 2015 09:47
jQuery toggle multiple divs independently with text change
$(".event-more-control").click(function(e) {
e.preventDefault(); // prevent default click event
$(this).toggleClass('active');
$(this).parentsUntil('event-index-details').children(".event-excerpt").slideToggle(500);
$(this).children(".link-text").text(function(i, oldText) {
return oldText === 'More' ? 'Less' : 'More';
});
});