treehouse : what would you like to learn today?
Web Design Web Development iOS Development

How to know which tag was selected?

  • Hello, I'm working on a simple product page were there will be two columns of products each in their own div with a id of "product-box". In each of the div's there is a p tag that is hidden, and an a tag that when clicked will toggle the p tag's display property. If I have about 10 to 20 products on a page, how can I tell which a tag was selected and to show the right p tag? Right now I only have two on a page and they both toggle when I select either a tag. Thanks in advance.

    here is the html for the a tag:

    <p><a href=\"#\" class=\"button\">click here for more information</a></p>


    the jquery js:

    $('a.button').click(function() {
    $('.more').toggle('slow');
    });