I found what the problem was... the code I have works fine but the problem was the buttons weren't getting 'clicked'.
So I added this to refresh the button 'click' and now everything works fine.
$('input[value="' + units + '"]').prop('checked', true).button('refresh');
EDIT:
Setting the buttonset class to class=radioButtons this code does what I need for any buttonset...
$(function(){
var radioButtonSet=$('.setCookies').find('.radioButtons');
radioButtonSet.buttonset();
var radio=$('.radioButtons').find(':radio');
radio.each(function(){
var selected=$.cookie(this.name);
$('#'+selected).prop('checked', true).button('refresh');
$(this).change(function() {
$.cookie(this.name, $(this).val(), {expires: 365});
});
});
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…