[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Checked property in HTML checkbox

Posted on 2006-03-27
3
Medium Priority
?
290 Views
Last Modified: 2008-03-17
Hey experts,

  What's the property in HTML to set to indicate if an input of type checkbox is checked or no?
0
Comment
Question by:mte01
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
jessegivy earned 1080 total points
ID: 16301895
Well there's two properties that control that.  If your talking about setting the checked status during runtime via script then you're talking about the checked property, to check all checkboxes on the page the function would look like this:

function checkAll()
{
   var inputs=document.getElementsByTagName("input");
   for(var i=0;i<inputs.length;i++)
   {
      if(inputs[i].type=="checkbox")
           inputs[i].checked=true;
   }
}

...however, if you want to set the checkboxes state in the tag, it's slightly different, no need to specify boolean value just include the word checked in the tag deffinition like so:

<input type="checkbox" id="someCheckbox" name="someCheckbox" checked>

Cheers,

JI
0
 
LVL 3

Author Comment

by:mte01
ID: 16301936
>>jessegivy

Yeh, I got that...thanks for your help!!
0
 
LVL 12

Expert Comment

by:jessegivy
ID: 16301991
You're most certainly welcome!  :)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question