Reputation: 1380
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
Upvotes: 0
Views: 203
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
Reputation: 20364
You can use the jQuery selector children. Try this example:
Or you can use .find()
Upvotes: 1