0

I have the following in my page,

This is a spryasset. This has 3 tabs.enter image description here

When I click "reviews" it shows reviews, if "more" then it shows more.

My question is,

How to listen to this "CLICK" event on a spryasset tab in jQuery?

beck03076
  • 3,268
  • 2
  • 27
  • 37

1 Answers1

3

Assuming that spryasset produces li for each tab you could do this:

$('#tabs li:eq(2)').on('click', function() {
  // your code here
});

Update:

The :eq(2) will return the 3rd (starting from 0) list element that is a child of some element with id=tabs. For more information on the :eq selector check out the jquery docs http://api.jquery.com/eq-selector/

lucuma
  • 18,247
  • 4
  • 66
  • 91
  • What is eq(2)? Can you explain whats going on?. Forgive my curiosity. – beck03076 May 30 '12 at 18:56
  • @beck03076 Sure thing.. I updated the answer. The jquery docs are great and for a full list of selectors check out this link http://api.jquery.com/category/selectors/ – lucuma May 30 '12 at 18:58
  • Let me take your lead and come back if I win. Thanks. – beck03076 May 30 '12 at 19:00
  • If you are a female, I would marry you. If you are not one, I would still marry you. Thanks a lot. It worked so beautifully. – beck03076 May 30 '12 at 19:14
  • I'm a dude so I'll happily accept the checkmark and a voteup in lieu of a marriage proposal! – lucuma May 30 '12 at 19:30