title: How to dynamically add button to jQuery-UI button-set?
body: <p>I am looking for a way to add a button to a jQuery button-set at run-time with JavaScript.</p>
  
  <pre><code>        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);
          }
  </code></pre>
  
  <p>I am adding the hyperlink to the div container of the button-set using JavaScript, and then re-calling <code>buttonset()</code> on the container.</p>
  
  <pre><code> $("#menu-buttonset").buttonset();
  </code></pre>
  
  <p>This however does not seem to rebuild the button-set as I expected.</p>
  
  <p>I am not seeing any function in the jQuery API for this either.</p>
  
  <p>Can anyone provide some insight?</p>
  
  <p><strong>Resolved:</strong></p>
  
  <p>Using refresh method as suggested, rebuilt the button-set.</p>
  
  <pre><code>$('#menu-buttonset').buttonset('refresh');
  </code></pre>