[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Jquery simple accordion using a list

Posted on 2011-09-08
22
Medium Priority
?
393 Views
Last Modified: 2012-05-12
Hi,

I am trying to create a simple jQuery accordion using the code here: http://jsfiddle.net/nhDxH/

The biggest issue I am having is adding/removing the class when I select an item. I can get the lists to hide/show. Any suggestions?

I would like to set the active class on the LI

Thanks,

Ryan
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 9
22 Comments
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36503764
Your css is not showing there.
By the way, which class you want to add and remove and on which event
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 36503776
Updated my CSS via the link, sorry!

I am trying to add ".active" to li.active

And on the click event.
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36503788
<<I am trying to add ".active" to li.active>>

You mean to say that if you already have a class active on li, you want to add it again?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 36503798
No I was writing out that the ".active" is being attached to a LI tag. On click of A add class "active" to the parent LI
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36503800
And css is still not there!! :)
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 36503809
Ah, hit run instead of update, try it out now! http://jsfiddle.net/nhDxH/1/

Thanks.
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36503888
i have done some updation, please check.

Please let me know what exactly is the requirement
0
 
LVL 1

Accepted Solution

by:
catonthecouchproductions earned 2000 total points
ID: 36503912
Close! Can you get the "active" class on to attach to the LI tag on click?
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36503965
check now
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 36503974
I still see the class being added to the <a> not the <li>

If its easier we can have the click event on the <li> so:

$('.ski_category').click(function() {
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36503999
check again, now only adding to parent li
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 36504010
I think fiddle is adding new links for each revision can you send me the copy you're working on?
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36504026
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 36504033
Awesome! thank you.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 36504041
I've requested that this question be closed as follows:

Accepted answer: 0 points for catonthecouchproductions's comment http:/Q_27297912.html#36504033

for the following reason:

Speedy and patient!
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 36504042
Can we reverse this? I clicked the wrong comment and didnt mean to flag it. This question was perfect and the expert helped me with that I needed. If we can reopen and I can award points, please.

Thanks,

Ryan
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36504051
why no point for me??
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 36504057
No i did! It was a mistake, clicked the wrong button :) clicked my own. You should be good now.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 36504449
One quick thing I just noticed! http://jsfiddle.net/nhDxH/7/ - click one of the child elements in side the list. the active gets added to that as well. It should have just been that parent LI
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 36515246
<< Close! Can you get the "active" class on to attach to the LI tag on click?>>
In this comment #36503912, you mentioned that you want the active to be attached to li tag on click.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
This article discusses how to implement server side field validation and display customized error messages to the client.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

656 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