Reputation: 2694
I am not familiar with jQuery so very much possible that I am overlooking something simple.
Is there a way to define these objects together, instead of 3 different instances?
$( "#accordion") .accordion({
active: false,
collapsible: true,
icons: icons,
autoHeight: false,
heightStyle: "content"
});
$( "#accordion_fulfillment") .accordion({
active: false,
collapsible: true,
icons: icons,
autoHeight: false,
heightStyle: "content"
});
$( "#accordion_warehouse") .accordion({
active: false,
collapsible: true,
icons: icons,
autoHeight: false,
heightStyle: "content"
});
I have tried doing the obvious but it's not working $( "#accordion", "#accordion_fulfillment", "#accordion_warehouse") .accordion({....})
Upvotes: 0
Views: 68
Reputation: 74738
You can try this way using attribute
selectors:
$( "[id^='accordion']") .accordion({ // <----this selects all ids which starts
active: false, // with accordion
collapsible: true,
icons: icons,
autoHeight: false,
heightStyle: "content"
});
Read more here jQuery( "[attribute^='value']" )
Upvotes: 4
Reputation: 14728
Close!
$( "#accordion, #accordion_fulfillment, #accordion_warehouse") .accordion({....})
Upvotes: 2