Radio buttons

in
Subscribe to Radio buttons 2 posts, 2 voices



Jonathanm Scriptwright

How do i get it to select radio buttons?
i.e. i want to use this to fill out surveys, with generic answers.
html of the survey looks like this:


class="radio" name="question_15" value="15_a" type="radio" id="15_a"

where there are other answers too but i want the script to check the radio box 15_b

how would i do this?

 
XaviEsteve Script's Author

Hi Jonathan,

I replied to you by e-mail but here's the solution for new readers.

After this code in the script:

// INPUT type RADIO
       /* Selects the last one */
         if (textElements[i].type == 'radio') {textElements[i].checked=true;}
}
You can add this:
if (document.getElementById('3_a')) {
  document.getElementById('3_a').checked = true;
}

Btw, please contact me by e-mail (found at my website) since I don't receive any notifications if you post here.

Cheers,

Lucky Shot

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel