code

JQuery UI Buttonset

two radio inputs become a jquery button set, with a small check for whether it is initialized.

html

<link
  rel="stylesheet"
  href="//code.jquery.com/ui/1.8.20/themes/base/jquery-ui.css"
/>
<div id="myRadio">
  <input id="first" type="radio" value="1" name="steps" /><label for="first"
    >First</label
  >
  <input id="second" type="radio" value="2" name="steps" /><label for="second"
    >Second</label
  >
</div>

javascript

$("#myRadio").buttonset();

$.fn.buttonsetIsInitialized = function () {
  return this.hasClass("ui-buttonset");
};

if ($("#myRadio").buttonsetIsInitialized()) {
  console.log("initialized: refresh");
} else {
  console.log("Not initialized");
}

this demo preserves the compiled output and may depend on external libraries or services that are no longer available.

original jsfiddle post