I need help to do the following:
For all <p> elements that contain X in class name
Find first <div> element after above <p> alement
Find first child <a> element of above <p>
Set onclick function for that <a> element to toggle(<div>) element found above
So in the following HTML code
<p class='foo_1'>
<a> bar </a> // a1
</p>
<div></div> // div1
<p class='foo_2'>
<a> bar </a> // a2
</p>
<div></div> // div2
When i click on a1 i want function toggle to be called for div1, and when i click on a2 i want function toggle to be called for div2.
I hope I phrased my question good enough so everyone can understand it. Any help would be greatly appreciated. Thanks
