1

I have this code at a RadioButton event onClick:

onClick="var colRadio = document.getElementsByName('Botones_Radio1'); if( colRadio[3].checked)alert('mensaje')"

It detect when the user click the third option and show a message. It work fine at IE Explorer, but not work in Chrome. I have used the onChange event too, but it dont work at Chrome.

Some help?

alberph
  • 61
  • 3
  • 13

1 Answers1

0

What is your doctype?

I have a feeling this possibly could be a onClick vs onclick problem.

see: onclick or onClick?

try instead using:

onclick="var colRadio = document.getElementsByName('Botones_Radio1'); if( colRadio[3].checked)alert('mensaje')"

Also check that the radio with the onclick code is not apart of the same radio group that you are testing for. Here is a working (in chrome) example: http://jsfiddle.net/lee_gladding/TY9CJ/2/

Community
  • 1
  • 1
lee_gladding
  • 1,090
  • 6
  • 10
  • It is my doctype: And I have tried with both (onclick and onClick). But only work fine at Explorer, not at Chrome – alberph Sep 05 '13 at 09:15
  • I am assuming the radio with the `onclick` code is not apart of the same radio group that you are testing for? As if it is then obviously this wont work as the one you test for will no longer have a checked status. If not then your actual onclick code seems to work fine for me in chrome, here is a fiddle example: http://jsfiddle.net/lee_gladding/TY9CJ/2/ – lee_gladding Sep 05 '13 at 10:09