Take the 2-minute tour ×

I have created a tab-pane using HAML as shown in my code snippet below (2 tabs)

      %button.btn#get_more_answers.hide Fetching Content

enter image description here

As shown above I have 2 tabs (.muses.active.tab-pane and questions.tab-pane)

Now I need to specify certain actions depending on which tab is active. How can I write the if statement to determine which tab-pane is active at one point of time?

share|improve this question
Posible answer here (stackoverflow.com/questions/300078/…) –  aki Feb 2 '12 at 11:29
add comment

1 Answer

up vote 1 down vote accepted

If you are using jQuery framework, you can find the active tab using following command, $('.active.tab-pane')

You can check if the active tab is a muse or question by checking against the class of that tab as follows,

  alert("its muses tab");
} else if($('.active.tab-pane').hasClass('questions')){
  alert("its questions tab");
share|improve this answer
thanks! this is what I needed –  Zhen Feb 2 '12 at 14:14
add comment

Your Answer


