select all checkboxes html js

<script language="JavaScript">
function toggle(source) {
  checkboxes = document.getElementsByName('foo');
  for(var i=0, n=checkboxes.length;i<n;i++) {
    checkboxes[i].checked = source.checked;
  }
}
</script>

<input type="checkbox" onClick="toggle(this)" /> Toggle All<br/>

<input type="checkbox" name="foo" value="bar1"> Bar 1<br/>
<input type="checkbox" name="foo" value="bar2"> Bar 2<br/>
<input type="checkbox" name="foo" value="bar3"> Bar 3<br/>
<input type="checkbox" name="foo" value="bar4"> Bar 4<br/>

0
2

                                    &lt;script language=&quot;JavaScript&quot;&gt;
function toggle(source) {
  checkboxes = document.getElementsByName('foo');
  for(var checkbox in checkboxes)
    checkbox.checked = source.checked;
}
&lt;/script&gt;

&lt;input type=&quot;checkbox&quot; onClick=&quot;toggle(this)&quot; /&gt; Toggle All&lt;br/&gt;

&lt;input type=&quot;checkbox&quot; name=&quot;foo&quot; value=&quot;bar1&quot;&gt; Bar 1&lt;br/&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;foo&quot; value=&quot;bar2&quot;&gt; Bar 2&lt;br/&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;foo&quot; value=&quot;bar3&quot;&gt; Bar 3&lt;br/&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;foo&quot; value=&quot;bar4&quot;&gt; Bar 4&lt;br/&gt;

0
0
5
1
Sergei 100 points

                                    function toggle(source) {
  checkboxes = document.getElementsByName('foo');
  for(var i=0, n=checkboxes.length;i&lt;n;i++) {
    checkboxes[i].checked = source.checked;
  }
}

5 (1 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
create select all javascript checkbox html checkbox check all check uncheck checkbox all check box html get all selected checkboxes javascript check all checkbox in javascript html check all checkboxes how to get all checkboxes in javascript how to get all checkboxes in a javascript js select all checkbox select all checkbox array javascript select all checkboxes javascript table w3 javascript check all checkboxes javascript select all checkboxes in ul select all for checkboxes js check all checkboxes js how to select all checkbox select all checkbox table javascript how to implement select all checkbox in html select all checkbox in html table javascript select all checkbox on table javascript select all checkbox in table javascript how to implement select all checkbox in javascript get all checkbox javascript select all checkbox which are checked in js select all checkbox example checkbox for check all select all checkboxes using checkbox check all check box javascript master checkbox for select all select all checkbox in javascript by tpye select all checkboxes button javascript html5 select all checkboxes javascript get all checkboxes javascript checkbox check all example checkbox all check all are selecting in checkbox javascript how to select all checkboxes using javascript select all checkbox foreach javascript javascript all checkbox checked select all checkbox in list html check all checkbox js select all checkbox without javascript select all checkboxes select all checkbox javascript w3schools javascript event select all checkboxes in table all checkbox checked javascript select all checkbox javascript by name implement select all checkbox javascript select all checkbox onclick javascript button to check all checkboxes check all functionality in checkbox input tag select all checkbox html select all javascript checkbox on clic check all checkbox javascript javascript to select all checkboxes on a page select all checkbox with manipulation array javascript select all checkbox of the page js make a select all in checkbox in html css js check all checkbox select all checkbox in javascript how to select single items in checkbox using javascript javascript checkbox checked all javascript find all checkboxes in div js checkbox select all checkbox html select all get all checkboxes select all checkbox in list js input type checkbox check all select all input type checkbox javascript input checkbox all check html select all checkbox select all checkbox html w3schools check all checkboxes javascript select all check box javascript select all checkbox w3schools select all checkbox javascript example javascript checkbox select all function javascript checkbox select all how to select all input type checkboxes javascript select all checkbox using javascript find all checkbox in javascript get all checkbox elements javascript get all checkboxes from page javascript get all checkboxes javascript button select all checkboxes with javascript select all checkbox on button click javascript html click on all checkboxes javascript select all checkbox get all html elements javascript JS select all fucnction select all checkbox js select all that applies javascript check all checkbox on one click form checkbox all how to select all button in javascript multiple select all checkbox html checkboxes click on one checkbox select all select allthe checked checkbox in simple js check all checkbox checked check all functionaltiy in checkbox html checkbox on check how to query select all checkboxes in html select all html form chek html select all statuses select all input type checkbox checkbox select all c$ select all checkboxs from list javascript onclick check all checkboxes select all javascript code How to check all the checkbox check or not vanilla javascript html select with checkboxes how select all checkbox select all button javascript query select all button javascript select all checkbox items in a list of check boxes javascript input checkbox select all js check all checkboxes check all boxes javascript select all checkboxes html making checkbox select all javascript why checkbox select all choose all checkbox how to checked all checkbox in javascript javascript to select all checkboxes javascript select all checkboxes related select all check box value select all javascript checkbox all checked javascript checkbox all checked and unchecked in javascript selecting all in html how to set checked all selection javascript checked all checkbox how to make a select all button checkbox all select with javascript how to make a select all checkbox in html when i click on one checkbox check all checkboxes when i click on one checkbox check all ch how to me check box select and unselect in html checkbox all javascript select all cehckboxes and select select all checkboxes javascript how to check all check box on click event select all checkbox option in html check all html javascript select all checkboxes check all checkbox states checkbox selected all in input type checkbox select boxes uncheck javascript list of checkboxes and main choose all checkbox select all checkboxes html js javascript check all checkboxes select all checkboxes in javascript select all .js folderbrowserify checkbox check all how to add select all checkbox in html select all option checkbox select all checkbox in form js select all checkboxes check all boxes only two lines multiple checkbox select all in js multiple checkbox select all in html checkbox to select all checkboxes how to select all checkboxes javascript js input checkbox to check all select all checkbox javascript does not check all boxes apply to all checkbox select all checkbox javascript select all button html checkbox select all Select/Deselect all Checkboxes with a Single Checkbox final form how do u call the checkbox that selects or deselects all the checkboxes in a list checkbox with select all html checkbox select all
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source