wallace740
wallace740

Reputation: 1380

Jquery toggle separately

I'm trying to use Toggle my contents under separate list items. But what s the best method to implement this in a generic way. I dont want to give each content a separate class or id

http://jsfiddle.net/kKDWR/6/

Upvotes: 0

Views: 203

Answers (2)

HBublitz
HBublitz

Reputation: 680

You make use of jQuery ... and you implement your feature in a jquery way. There's nothing wrong with it.

I'd only recommend to have a parent element (propably your current <UL>) with an ID (for example <ul id="forum_entries>"). So you can address the items as $(".tog", "#forum_entries"). This can be much faster than simply addressing by classname, if your document becomes large.

Upvotes: 0

Tim B James
Tim B James

Reputation: 20364

You can use the jQuery selector children. Try this example:

http://jsfiddle.net/kKDWR/8/

Or you can use .find()

Upvotes: 1

Related Questions