OK, so they're actually children of the grandparents (aunts/ uncles?)... var checkBoxes = $('.form-checkbox').click(function(e, triggered){ $(this).parent().siblings('input:radio')[0].disabled = triggered ? this.checked : !this.checked; }); $('#toggle').click(function(){ checkBoxes.trigger('click', [true]); }); $('#all').click(function() { checkBoxes.not(':checked').trigger('click', [true]); }); $('#none').click(function() { checkBoxes.filter(':checked').trigger('click', [true]); });
On Oct 26, 7:01 pm, Feijó <[EMAIL PROTECTED]> wrote: > Ops, sorry > > I add this jquery to dynamicaly insert the radio > > $(document).ready(function() { > $('.form-checkbox').parent().parent().prepend(' <input type=radio > name=radio class=radio disabled> '); > > }); > > On Oct 26, 3:28 pm, Wizzud <[EMAIL PROTECTED]> wrote: > > > And the radio buttons would be .... where? > > > On Oct 26, 11:35 am, Feijó <[EMAIL PROTECTED]> wrote: > > > > Here it is > > > > If any checkbox is clicked, it needs do enable the radio next to it. > > > > In the bottom I have 3 links to check it all, uncheck it all, or > > > toggle. In those cases the radios need to respond as well. > > > > That's my last jquery attempt: > > > > $('.form- > > > item:checkbox:not(:checked)').siblings(':radio').removeAttr('disabled'); > > > > Thanks! > > > > <div><fieldset class=" collapsible"><legend>Rules</legend><div > > > class="form-item"> > > > <label>Values: </label> > > > <div class="form-checkboxes"><div class="form-item"> > > > <label class="option"><input type="checkbox" name="options[1]" > > > id="edit-options-1" value="1" class="form-checkbox" /> Option 001</ > > > label> > > > > </div> > > > <div class="form-item"> > > > <label class="option"><input type="checkbox" name="options[2]" > > > id="edit-options-2" value="2" class="form-checkbox" /> Option 002</ > > > label> > > > </div> > > > <div class="form-item"> > > > <label class="option"><input type="checkbox" name="options[3]" > > > id="edit-options-3" value="3" class="form-checkbox" /> Option 003</ > > > label> > > > </div> > > > <div class="form-item"> > > > <label class="option"><input type="checkbox" name="options[4]" > > > id="edit-options-4" value="4" class="form-checkbox" /> Option 004</ > > > label> > > > > </div> > > > <div class="form-item"> > > > <label class="option"><input type="checkbox" name="options[5]" > > > id="edit-options-5" value="5" class="form-checkbox" /> Option 005</ > > > label> > > > </div> > > > <div class="form-item"> > > > <label class="option"><input type="checkbox" name="options[6]" > > > id="edit-options-6" value="6" class="form-checkbox" /> Option 006</ > > > label> > > > </div> > > > <div class="form-item"> > > > <label class="option"><input type="checkbox" name="options[7]" > > > id="edit-options-7" value="7" class="form-checkbox" /> Option 007</ > > > label> > > > > </div> > > > <div class="form-item"> > > > <label class="option"><input type="checkbox" name="options[8]" > > > id="edit-options-8" value="8" class="form-checkbox" /> Option 008</ > > > label> > > > </div> > > > <div class="form-item"> > > > <label class="option"><input type="checkbox" name="options[9]" > > > id="edit-options-9" value="9" class="form-checkbox" /> Option 009</ > > > label> > > > </div> > > > <div class="form-item"> > > > <label class="option"><input type="checkbox" name="options[10]" > > > id="edit-options-10" value="10" class="form-checkbox" /> Option 010</ > > > label> > > > > </div> > > > </div> > > > </div> > > > <a href=javascript:; id=toggle>Inverter</a> <a href=javascript:; > > > id=all>Todos</a> <a href=javascript:; id=none>Nenhum</a></fieldset> > > > > On Oct 25, 8:53 pm, Wizzud <[EMAIL PROTECTED]> wrote: > > > > > Need a bit more information! > > > > If you don't show us some HTML it's a bit difficult to second guess > > > > the relationship between checkbox and radio. > > > > > On Oct 25, 8:34 pm, "Alessandro Feijó" <[EMAIL PROTECTED]> wrote: > > > > > > I'm trying to control N checkboxes, when one is selected or > > > > > unselected, I > > > > > need to enable/disable a radio next to the checkbox > > > > > > something like this: > > > > > > ( ) [ ] > > > > > (o) [x] > > > > > > the marked one, turn the radio clickable > > > > > > I start this code > > > > > > $('.form-checkbox').each( function() { > > > > > $('.form-checkbox:radio').attr('disabled', > > > > > $(this).attr('checked')); > > > > > }); > > > > > > It returns every checkbox, but I cant figure out how to find the radio > > > > > object from each one > > > > > > Thanks in advance for any tip :) > > > > > > huge hug > > > > > Feijó