Question: checkboxes set to true using JavaScript

Ads

 
 
 

Share on Google+Share on Google+

samar
checkboxes set to true using JavaScript
3 Answer(s)      6 years and 6 months ago
Posted in : JavaScript Questions

To set all checkboxes to true using JavaScript?

Ads
View Answers

November 10, 2010 at 12:36 PM


We can use following code to set all the checkboxes to true using javaScript.

Gyan
Singh
Ankit
Kumar
Kaushal



November 10, 2010 at 12:36 PM


We can use following code to set all the checkboxes to true using javaScript.

Gyan
Singh
Ankit
Kumar
Kaushal



November 10, 2010 at 12:37 PM


<head>
<script type="text/javascript">
function SelectAll() {
var checkboxes = document.getElementsByTagName("input");
for(i=0;i<checkboxes.length;i++) {
if(checkboxes.item(i).attributes["type"].value == "checkbox") {
checkboxes.item(i).checked = true;
}
}
}
function deSelectAll() {
var checkboxes = document.getElementsByTagName("input");
for(i=0;i<checkboxes.length;i++) {
if(checkboxes.item(i).attributes["type"].value == "checkbox") {
checkboxes.item(i).checked = false;
}
}
}
</script>
</head>
<body>
<input type="checkbox" name="list" value="1">Gyan<br>
<input type="checkbox" name="list" value="2">Singh<br>
<input type="checkbox" name="list" value="3">Ankit<br>
<input type="checkbox" name="list" value="4">Kumar<br>
<input type="checkbox" name="list" value="5">Kaushal<br>
<input type="submit" value="checkAll" onclick="SelectAll()" />
<input type="submit" value="uncheckAll" onclick="deSelectAll()" />

</body>

Ads









Related Tutorials/Questions & Answers:
checkboxes set to true using JavaScript
checkboxes set to true using JavaScript  To set all checkboxes to true using JavaScript
set the focus on an element using Javascript
set the focus on an element using Javascript  How to set the focus on an element using Javascript
Advertisements
JavaScript Array of checkboxes
JavaScript Array of checkboxes   ... that help you in understanding JavaScript Array of checkboxes. For this we are using JavaScript as Script language. In this example we make a HTML form
how to display selected checkboxes dynamically using jsp
how to display selected checkboxes dynamically using jsp  Hi friends i have a requirement that : in my JSP page i have radio buttons followed by the DB fields..when i click SUBMIT button,if the field(or record
property in javascript get set
property in javascript get set  How to create the get and set property in JavaScript?   Creating Get and Set properties in JavaScript example.. myVar Sample = { nval : "", get get() { return this.nval; }, set
Maintaining States of Selected CheckBoxes in Different Pages using dispaly table in struts2
Maintaining States of Selected CheckBoxes in Different Pages using dispaly... me how to maintain States of Selected CheckBoxes in Different Pages using... i am showing the list using a displaytag.Each row in the list has a checkbox
javascript set scroll height
javascript set scroll height  How to set scroll height in JavaScript?   CSS Scroll Method div { width:150px; height:150px; overflow:scroll; } JavaScript ScrollTo method <script type="text/javascript">
How to use Sigma grid built-in capabilities to calculate aggregates where Sortable property set to TRUE
Sortable property set to TRUE  How to use Sigma grid built-in capabilities to calculate aggregates where Sortable property set to TRUE, So that We can also...: but here Sortable property has been set to false. I need to implement
Updating multiple value depending on checkboxes
Updating multiple value depending on checkboxes  Hi .. I want to Update the multiple values of database using checkboxes and want to set the session for selected checkboxes..? please answer if any one knows as soon as possible
send mail using JavaScript
send mail using JavaScript  How can we send mail using JavaScript?   Hi friends, You can not send email directly using JavaScript. But you can use JavaScript to execute a client side email program send the email using
Date object using JavaScript
Date object using JavaScript  What's the Date object using JavaScript
delete an entry using JavaScript
delete an entry using JavaScript  How to delete an entry using JavaScript
using for loop in javascript
using for loop in javascript  How to use for loop in JavaScript
How to insert multiple checkboxes into Msaccess database J2EE using prepared statement - Java Beginners
How to insert multiple checkboxes into Msaccess database J2EE using prepared statement  Dear Experts, Tried as I might looking for solutions to resolve my Servlet problem, I still can't resolve it. Hope that you can share
timer using javascript
timer using javascript  How to display timer on HTML page using JavaScript
xls to js using javascript
xls to js using javascript  ![how can we convert a xls file in js file using javascript][1
maximize an image using javaScript
maximize an image using javaScript  Write the code to maximize an image using javaScript
List of checkboxes - JSP-Servlet
or more checkboxes are checked and the delete button is clicked...', true
how to set values from parent page to iframe in javascript
how to set values from parent page to iframe in javascript  how to set values from parent page to iframe in javascript pls reply me as possible as I am in great trouble
How to shift and unshift using JavaScript?
How to shift and unshift using JavaScript?  How to shift and unshift using JavaScript
java code for print true if even and false if odd and print error if any float value with out using conditional and looping statement
java code for print true if even and false if odd and print error if any float value with out using conditional and looping statement  hi class...(arg[0]); System.out.println(true num%2==0); System.out.println(false num
Array of checkboxes - Struts
Array of checkboxes  How to handle unknown number of checkboxes using tag in an ActionForm.   Hi friend, Code for multiple checkbox import javax.servlet.http.HttpServletRequest; import
The checkboxes tag
In this section, you will learn about checkboxes tag of Spring form tag library
validate radio button using javascript
validate radio button using javascript  validate radio button using javascript
associate functions with objects using JavaScript
associate functions with objects using JavaScript  How to associate functions with objects using JavaScript
convert numbers to strings using JavaScript
convert numbers to strings using JavaScript  How to convert numbers to strings using JavaScript
read and write a file using javascript
read and write a file using javascript  How to read and write a file using javascript
Math Constants and Functions using JavaScript
Math Constants and Functions using JavaScript  What's Math Constants and Functions using JavaScript
php return true false
php return true false  i wanted to create php function that returns true/false
Jsp-delete checked checkboxes and display UNCHECKED checkboxes in table as well as in store that unchecked checkboxes in ARRAYLIST
Jsp-delete checked checkboxes and display UNCHECKED checkboxes in table as well as in store that unchecked checkboxes in ARRAYLIST  I have a table... checkboxes should be displayed. And we should keep remaining checkboxes
javascript date validation using regex
javascript date validation using regex  Hi, I want to validate the date using javascript. Please help.   <html> <head> <title>Validating Date format</title> <script type="text/javascript">
Tutorials   
Java Spring Hibernate Struts Training code for programming How can I dynamically load user-entered data as content of jquery dialog? java webcam integration question java coding Fix Scrollbar position in a checkboxList after postback Information Save Alert Country wise redirection to files Interface in javascript connect database with javascript Zip Code ZipCode how to validate the email login How to play FLV video files on Ipad using HTML code or javascript code? Nitobi Grid is not working in IE10/IE11 jquery issue plese help RegEx Tree structure from json whose parents can be dragged and dropped from child newyorklife insurance getElementById not working javascript code for search in html file Implement The Skeleton Code Implement This Skeleton Code Mobile Automation using Appium Computer forensic application Java: Searching a string from doc files java linked list urgent !!! java linked list urgent!!! library management library management library management library management question Html form using JavaScript to display the table content java how to prevent no from unroundin off on clicking text box again in JSP and Jquery graph generation from xml design file display data from database in textbox when id entered in textbox Javascript Code for all fields how to get HTTP GET request value using javascript array Javascript Querry autocomplete(): Spring mvc with jquery: I am not getting correct value in the text filed. Please help me Create SpreadSheet same as excel using java applet Create SpreadSheet same as excel using java applet How to change focus among multiple select boxes? Write JQUERY Code Write JQUERY Code Converting jsp variable to java variable java

Ads

 
Advertisement null

Ads