You're probably just missing the UI button library (libraries are added when they're needed rather than every js file being included for every page).
To fix, add this in your page callback:
drupal_add_library('system', 'ui.button');
To ensure your JS code is invoked after AJAX calls, you just need to wrap it in a Drupal behaviour:
(function($) {
Drupal.behaviors.myModule = {
attach: function(context, settings) {
$('.form-item-service-amount', context).once('mymodule').buttonset();
}
};
})(jQuery);
There's no need to use ready()
in this context, Drupal will fire attachBehaviors()
on document load, and when ajax calls occur, and your module's attach function will be called each time.
once()
just makes sure the buttonset is only applied to an individual element once only, to avoid reattaching behaviours to elements that have already had it.