Is checkbox single checked - Node.js HTML

Node.js examples for HTML:Checkbox

Description

Is checkbox single checked

Demo Code

function isSingleChecked(field){
  var sel = false;
  var objs = document.getElementsByName(field);
  if(null == objs || typeof(objs)=='undefined'){
    return;//from ww  w  .j  a va 2 s . c  om
  }
  for(var i=0;i<objs.length;i++){
    if(objs[i].checked){
      sel = true;
      break;
    }
  }
  return sel;
}

Related Tutorials