jQuery Mobile radio disable if not checked by default -
i returning results of form user upon submitting. form includes fieldsets of radio buttons. resulting view after post returns selection default checked state. how can disable radio buttons not checked?
to give code example:
<input id="1-4" name="section[1]" value="3" type="radio" checked="checked"/> <input id="1-5" name="section[1]" value="4" type="radio" />
so this, need jquery (mobile) disable radio boxes, easy, recognize checked state , enable particular 1 proper markup in placed, or in case removed, dom.
all of code dynamically generated in system. in effort reuse code much possible, best manipulate dom rather writing code farther separate form view.
thanks in advance.
i'd suggest:
$('input:radio').prop('disabled', function(){ homecoming !this.checked; });
js fiddle demo.
or:
$('input:radio').prop('disabled', function(){ homecoming !this.defaultchecked; });
js fiddle demo.
references:
htmlinputelement
. prop()
. jquery jquery-mobile radio-button
No comments:
Post a Comment