Checked property in HTML checkbox

Posted on 2006-03-27
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?
Question by:mte01
    LVL 12

    Accepted Solution

    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++)

    ...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>


    LVL 3

    Author Comment


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

    Expert Comment

    You're most certainly welcome!  :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Javascript: Crash Course

    Javascript is not only emerging as the most important language to know, it's flexibility is unique. With Javascript being deployed on the web, mobile and even the desktop this is the one language that all technologists need to know.

    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
    In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
    In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now