Note that there are some explanatory texts on larger screens.

plurals
  1. POJquery checkbox target id's only one
    primarykey
    data
    text
    <pre><code>$(document).ready(function (){ $(function(){ $('input:checkbox').prop('checked', false) $('input:checkbox').click(function(){ if($(this).is(':checked')){ $('input:checkbox').not(this).prop('checked', false); } }); }) showdiv(); }); </code></pre> <hr> <p>The above code works awesome!! first it makes all the checkboxes "unchecked" then It makes it so only "one" checkbox can be checked at a time! </p> <p>But... i need it too effect only the three checkboxes below! Not all the checkboxes on the page!!! Guess i dunno how to make it target just the id's co33, co34, co35..</p> <pre><code>&lt;input name="option[13]" id="co33" value="33" checked="checked" onclick="showdiv()" type="radio"&gt; &lt;input name="option[14]" id="co34" value="34" checked="checked" onclick="showdiv()" type="radio"&gt; &lt;input name="option[15]" id="co35" value="35" checked="checked" onclick="showdiv()" type="radio"&gt; </code></pre> <p>And then!!! ... if one of those is checked then this 4th checkbox gets checked too!! If NONE of the three above are checked then this one isnt checked either!</p> <pre><code>&lt;input id="a1" type="checkbox" onclick="showdiv()" name="add[1]"&gt; </code></pre> <p>Man i hope that came out right.. the html is created automatically so i cant make em all have the same id or add a class so im looking to see if i can target them by id name .. Frankly even just being able to make the code initially posted to effect just the 3 checkboxes would be awesome.. Getting the 4th checkbox to be checked if one of the three is checked is a bonus!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload