I have a small bit of jquery that applies the jquery-ui accordian to an array of divs.
The divs are generated dynamically and each one needs to have a unique ID. I have successfully generated unique IDs for divs with each one having a different number at the end. Now I would like the jquery to be flexible enough to handle any of the divs no matter what number is at the end. All the divs have IDs with the naming convention "activity-accordion123" or "activity-accordian+number"
Here is the code I am using currently for the divs that have already been generated:
$(function() {
$( "#activity-accordion408,#activity-accordion410,#activity-accordion415,#activity-accordion428,#activity-accordion439,#activity-accordion427" ).accordion({
collapsible: true,
heightStyle: "content",
active: false,
header: "h3",
navigation: true
});
});
I would like to change this javascript so that it will work with any div that has the ID of "activity-accordion+any number". Is this possible?