Possible duplicate:
How to select an element by class inside "this" in jQuery
I'm new to jQuery ... I think this has something to do with using the "this" command, but not sure.
I have a page that programmatically creates several such divs:
<div class="moreinfolink">Click For More Information <div class="moreinfotext">Additional Info Here</div> </div>
So, there are several .moreinfolink and .moreinfotext classes on the page.
I used this code to switch the divinfotext div:
$('.moreinfolink').click(function() { $('.moreinfotext').toggle('slow', function() { });
But this, obviously, means that for ALL sections of more information that exist on the page, there is a switch.
Two questions: How can I do this for a specific child div that is inside the parent divinfolink div? Is there a better way to do this than the one I'm going to do?
Thanks!
source share