JQuery Buttonset - Add button

Posted by leaf dev on Stack Overflow See other posts from Stack Overflow or by leaf dev
Published on 2010-12-24T05:00:15Z Indexed on 2010/12/28 3:54 UTC
Read the original article Hit count: 187

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery