Is <select> selected - Node.js HTML

Node.js examples for HTML:Select Option

Description

Is <select> selected

Demo Code

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

Related Tutorials