www.webdeveloper.com
Results 1 to 3 of 3

Thread: How to check radio button on specific inputs

  1. #1
    Join Date
    Nov 2004
    Location
    Singapore
    Posts
    84

    How to check radio button on specific inputs

    Hi All, cracked my head on this, need some helps...

    I have rows after rows of radio <INPUT> field with system generated value, eg.

    <INPUT type=radio name=ID0001>
    <INPUT type=radio name=ID00x3>
    <INPUT type=radio name=ID00AB>
    <INPUT type=radio name=ID12NB>
    .
    .
    .

    Now I need to find a way to check all of them, but since the names are randomly generated, I must find a way to tag them under the same group.

    Any advice?

  2. #2
    Join Date
    May 2006
    Location
    Odenton, MD
    Posts
    1,449
    put all those radio input inside an element of your preference and get them with getElementsByTagName:
    HTML Code:
    <div id='group'>
    <INPUT type=radio name=ID0001>
    <INPUT type=radio name=ID00x3>
    <INPUT type=radio name=ID00AB>
    ...
    </div>
    and to refer them
    Code:
    var radio_inputs = document.getElementById('group').getElementsByTagName('input');

  3. #3
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,415

    Question Question

    Just a question ... What is the purpose:
    I have rows after rows of radio <INPUT> field with system generated value, eg.
    Why use radio buttons when there is only one option? If becomes set, then there is no way to un-set.
    Why not use checkbox instead?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles