What would be the best way to optimise(shorten) this block of code?. I’m using the Jquery UI plugin ‘select menu’ to assign to a select number of elements.
$('footer#footer form select').selectmenu({
style: 'dropdown',
appendTo: 'footer#footer form span'
});
$('form.filters section.grid .industry select').selectmenu({
style: 'dropdown',
appendTo: 'form.filters section.grid .industry'
});
$('form.filters section.grid .subject select').selectmenu({
style: 'dropdown',
appendTo: 'form.filters section.grid .subject'
});
$('form.filters section.grid .year select').selectmenu({
style: 'dropdown',
appendTo: 'form.filters section.grid .year'
});
$('form.filters section.grid .organiser select').selectmenu({
style: 'dropdown',
appendTo: 'form.filters section.grid .organiser'
});
You could a map of “selectors” to the “append” part
Or you could do this.