?
Solved

jquery click toggle class

Posted on 2011-10-07
2
Medium Priority
?
307 Views
Last Modified: 2012-05-12

Hello Experts,

i have this very simple code which basically add class to the ul list when its clicked.
when the user click on any of the other list i want to remove the class. currently it stays highlighted though i clicked on the next list.

 
$('#faq_collection li a').click( function() {
	$(this).toggleClass('active');

Open in new window

0
Comment
Question by:Refael
2 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 36933069
$('#faq_collection li a').click( function() {
$(".active").removeClass("active");
      $(this).toggleClass('active');
0
 

Author Closing Comment

by:Refael
ID: 36933425
thank you so much!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses
Course of the Month15 days, 18 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question