0

jQuery mobile leaves the radio button visible. Is this possible with jQueryUI without too much effort? Users understand the functionality of a radio button, so I'd prefer to keep that visual recognition.

jQuery Mobile Radio Button

1 Answer 1

1

jQuery

$("#radioSet").buttonset();
$("#radio1").button("option", "icons", { primary: 'ui-icon-check' });
$("#radio2").button("option", "icons", { primary: 'ui-icon-check' });

$("#radioSet input[type=radio]").on("click", function () {
    $("#radioSet input[type=radio]").each(function () {
        if ($(this).is(":checked")) {
            $(this).button("option", "icons", { primary: 'ui-icon-check' });
        } else {
            $(this).button("option", "icons", { primary: 'ui-icon-cancel' });
        }
    });
});

Html

<div id="radioSet">
    <input type="radio" id="radio1" name="radio" checked="checked" />
    <label for="radio1">Radio 1</label>

    <input type="radio" id="radio2" name="radio" />
    <label for="radio2">Radio 2</label>
</div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.