set Check Box Attribute

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aarushi2001
    New Member
    • Nov 2006
    • 3

    set Check Box Attribute

    Hi,

    I have a check box in my form. I was wondering how can I do the following:

    when someone checks the box and hits submit, the checkbox.checke d shud be checked to true. If it is unchecked, the value should be set to false.

    I need to use JavaScript/DOM. Any hints?
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    You could set it using server-side code, but if with JavaScript, then when the document body has loaded:
    [code=javascript]checkbox.checke d = true;
    // or alternatively:
    checkbox.defaul tChecked = true;
    // you could also use setAttribute().[/code]

    Comment

    Working...