i have small bit of jquery applies jquery-ui accordian array of divs.
the divs generated dynamically , each 1 needs have unique id. have generated unique ids divs each 1 having different number @ end. jquery flexible enough handle of divs no matter number @ end. divs have ids naming convention "activity-accordion123" or "activity-accordian+number"
here code using divs have 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 change javascript work div has id of "activity-accordion+any number". possible?
use id attribute selector wildcard 'start with' that:
$('div[id^="activity-accordion"]').accordion({ collapsible: true, heightstyle: "content", active: false, header: "h3", navigation: true });
Comments
Post a Comment