I have been trying, unsuccesfully, to add multiple jQuery accordions to the same page. The first accordion works properly but any subsequent show as static text.
From searching the web I could not find anyway to add multiple accordions; however, I did see many people with similar questions as to how to implement this.
Simple question first: Is it possible to have more than one jQuery accordion per page?
--A jQuery novice
I guess my question is slightly different then....
I had put the following in a separate .js file
with the intention of including this .js file in mutliple pages that may each have multiple accordions on them.
This however apparently only takes the first element where ID="accordion" - how would I set this up so that I could include the .js file and set each different accordion?
What I do not want to have to do is to include the names of each individual accordion in the above code. Can I associate the above to a class rather than an ID? I tried that without much success however this is all rather new to me.
id values are strong juju, and should only be used to identify individual elements. As Ankit pointed out, to add an element to a general class of elements for selection, assigning a class to the elements is exactly what the class attribute was intended for.
jQuery also gives you many other ways to make selections. Learn to not rely upon the id quite so much