jquery click toggle class


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

RefaelAsked:
Who is Participating?
 
leakim971Connect With a Mentor PluritechnicianCommented:
$('#faq_collection li a').click( function() {
$(".active").removeClass("active");
      $(this).toggleClass('active');
0
 
RefaelAuthor Commented:
thank you so much!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.