JQuery Buttonset - Add button
- by leaf dev
I am looking for a way to add a button to a JQuery buttonset at runtime with javascript.
if(response.success) {
var menuItem = document.createElement('a');
$(menuItem).attr('href', response.href);
$(menuItem).attr('category-id', response.id);
$(menuItem).text(title);
$("#menu-buttonset").append(menuItem);
}
I am adding the hyperlink to the div container of the buttonset using javascript, and then re-calling buttonset() on the container.
$("#menu-buttonset").buttonset();
This however does not seem to rebuild the buttonset as I expected.
I am not seeing any function in the JQuery API for this either.
Can anyone provide some insight?