'jQuery second selector not working
I have this jQuery code that works:
$('#info').on('click', '.border', function() {
$(this).children(".moreinfo").slideToggle(200);
});
When I change the second selector to .border h3
to only refer to the <h3>
it doesn’t toggle. How can I get this working?
Solution 1:[1]
This worked:
$('#info').on('click', '.border h3', function() {
$(this).parent('.border').find(".more-info").slideToggle(200);
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | vinzee |