Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome 21 not checking radio buttons

I figured this out after much effort so I thought I'd share what I came across, so others can benefit from my effort. Firefox IE and chrome 19 (the only other version I have handy) don't have a problem with this, but chrome 21 does.

If you have this radiobutton

<input type='radio' name'k1' value='v1' checked>

it will not appear checked on the page if it's in an invalid location.

For example I had

<table>
<input type='radio' name'k1' value='v1' checked> 
<tr><td>table information</td></tr> 
</table> 

and no matter what I did, it wouldn't appear checked when the page loaded.

like image 782
stu Avatar asked Aug 13 '12 15:08

stu


People also ask

How do you get radio button is checked or not?

Using Input Radio checked property: The Input Radio checked property is used to return the checked status of an Input Radio Button. Use document. getElementById('id'). checked method to check whether the element with selected id is check or not.

How can I get radio button to click?

To check which radio button is selected in a form, we first get the desired input group with the type of input as an option and then the value of this selection can then be accessed by the val() method. This returns the name of the option that is currently selected.

How do I select a radio button on a tab?

When focus moves to the group in which a radio button is selected, pressing Tab and Shift+Tab keys move focus to the radio button that is checked. Up Arrow and Down Arrow keys move focus and selection.

How do I display radio buttons side by side?

To make a horizontal radio button set, add the data-type="horizontal" to the fieldset . The framework will float the labels so they sit side-by-side on a line, hide the radio button icons and only round the left and right edges of the group.


1 Answers

Tested on Google Chrome 21.0.1180.75 and .79

<table>
  <input type="checkbox" name="n" value="v" checked="checked" />
</table>

Missing the <tr><td></tr></td> around the input element causes checked checkboxes not to appear as checked. Additionally, when the form is submitted, those checkboxes don't come to the server-side as being checked, either!

Once the html is formatted properly, the checkboxes should appear checked as indicated by the checked attribute:

<table>
  <tr>
    <td>
      <input type="checkbox" name="n" value="v" checked="checked" />
    </td>
  </tr>
</table>
like image 163
Dave T. Avatar answered Sep 22 '22 02:09

Dave T.