Is checkbox checked - Node.js HTML

Node.js examples for HTML:Checkbox

Description

Is checkbox checked

Demo Code

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

Related Tutorials