While trying to meet my requirements, I encountered a discrepancy between running the page in IE browser versus Chrome. The code worked successfully in IE, but not in Chrome.
for(var gridNo=0;gridNo < 30;gridNo++){
var fldId = arry[0]+'_'+arry[1]+'_'+arry[2]+'_'+arry[3]+'_'+gridNo;
var doc = document.getElementsByName(fldId);
alert(doc);
var doc1=doc;
if(eval(doc)== null){
alert("Oops....!");
break;
}
alert("The value of the Element By Name "+doc1);
alert("The value of the Element By Id"+document.getElementById(fldId));
var selectedDropDown = getSelectedDropDownValue(document.getElementsByName(fldId));
alert("The Value is: "+selectedDropDown);
if(parseInt(selectedDropDown) == 0){
gridEmpCount = gridEmpCount + 1;
}else if(parseInt(selectedDropDown) == 1){
gridSpouseCount = gridSpouseCount + 1;
}else if(parseInt(selectedDropDown) == 2){
gridParentCount = gridParentCount + 1;
}
}
After some investigation, I realized that I need to utilize document.getElementById(). This solution works in IE, but fails in Chrome. Please assist me with this issue.