Get a free trial // Grow your CSS skills // Land your dream job

How to know which tag was selected?

  • # October 20, 2008 at 1:16 am

    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:

    the jquery js:

    $(‘a.button’).click(function() {
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed