buttonMarkup is marked as deprecated from version 1.4 (discussed elsewhere), but the documented equivalent using button("option", ...) does not appear to work.
I have four colour buttons and want to move the check mark to the one that's just been clicked (a little odd, but it works fine for users). The following code works:
- for (var _i = 0; 4 > _i; _i += 1) {
if (baseColour === _i) {
$(COLOUR_BUTTON_IDS[_i]).buttonMarkup({ icon: 'check', iconpos: 'left' });
} else {
$(COLOUR_BUTTON_IDS[_i]).buttonMarkup({ icon: 'none', iconpos: 'none' });
}
}
But using button("option"... for the same purpose does not:
- for (var _i = 0; 4 > _i; _i += 1) {
if (baseColour === _i) {
$(COLOUR_BUTTON_IDS[_i]).button("option", "icon", "check");
$(COLOUR_BUTTON_IDS[_i]).button("option", "iconpos", "left");
} else {
$(COLOUR_BUTTON_IDS[_i]).button("option", "icon", "none");
$(COLOUR_BUTTON_IDS[_i]).button("option", "iconpos", "none");
}
}
The former does what I want and expect; the check mark shuffles along to the button just pressed. In the latter example precisely nothing happens,
I have tried adding a button("refresh") at the bottom of the loop (for each button) but this has no effect. So unless I have overlooked something - and I am happy to be told I have - I wouldn't start avoiding buttonMarkup just yet.
I am using jqm 1.4.2 and jq 2.1. Have test with latest versions of Mozilla and Chrome on Windows 8.1.