Skip to main content

jQuery Mobile – Toggle enable and disable state of a radio button



I have a radio button that I would like to be able to enable and disable through jQuery Mobile.





Radio button code:







<input type="radio" disabled="disabled" value="option1" />







tried:







$('input[type="radio"]').removeAttr('disabled');







and







$('input[type="radio"]').attr('disabled', '');







Neither of which seem to be able to toggle the button to enabled.


Comments

  1. <input type="radio" id="rdoToggle" value="option1" />
    $("input[type='radio']").checkboxradio('enable');


    Refer the documnentation , jQuery and jQuery Mobile are different in this action.

    $('#rdoToggle').toggle(function() {
    $("input[type='radio']").checkboxradio('enable');
    }, function() {
    $("input[type='radio']").checkboxradio('disable');
    });

    ReplyDelete
  2. Try to use $(elem).prop('propertyname') see more: http://api.jquery.com/prop/

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?