función checkRadio


/ Published in: JavaScript
Save to your folder(s)

Descripcion: Validar preguntas obligatorias con radio
Recibe: Objeto radio de un formulario
Devuelve: true si hay alguno que se encuentra checked, sino false.


Copy this code and paste it in your HTML
  1. function checkRadio(objRadio){
  2. var arrayObjRadio=document.getElementsByName(objRadio.name);
  3. for(var pos=0;pos<=arrayObjRadio.length-1;pos++){
  4. if(arrayObjRadio[pos].checked==true){
  5. return true;
  6. }
  7. }
  8. return false;
  9. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.