Reputation: 6304
http://jsfiddle.net/KevinOrin/KHHDT/
After clicking open 1 of the black bars/accordions (example: "Greenhouse Gases") I have a link "More/Less info" that is suppose to toggle more information. The problem is the click function is not on the "More/Less info" element but the entire "."happening-main-text" element. Clicking anywhere in the div activates the toggle and that shouldn't be. Any ideas how to modify this jQuery to target JUST the .readmore in that div?
// More/Less Info Why Is Is Happening
jQuery('.readmore').closest(".happening-main-text").click(function()
{
jQuery(this).children(".divmore").toggle('slow');
return false;
});
Upvotes: 0
Views: 178
Reputation: 382150
Use
jQuery('.readmore').click(function() {
jQuery(this).closest(".happening-main-text").children(".divmore").toggle('slow');
return false;
});
What you did what precisely binding the event to the enclosing ".happening-main-text"
element.
Upvotes: 2