Cannot get checkbox element in Datagrid using javascript in FF
-
I have a checkbox in a datagrid and when i check the items and press addbutton i need to add all the checked rows value into hidden field.the add button calls the function readData() on client side. the code was working fine with IE but it was not woking with mozilla function ReadData() { var grdContacts = document.getElementById('grdContacts'); var hiddenContacts = document.getElementById('hiddenContacts'); var rowCount = grdContacts.rows.length; if(rowCount > 1) { var count =1; for(; count < rowcount ; count++) { if(grdContacts.rows[count].cells[0].childNodes[0].childNodes[0].checked == true) { hiddenContacts.value += grdContacts.rows[count].cells[2].innerText + ";"; } } }
-
I have a checkbox in a datagrid and when i check the items and press addbutton i need to add all the checked rows value into hidden field.the add button calls the function readData() on client side. the code was working fine with IE but it was not woking with mozilla function ReadData() { var grdContacts = document.getElementById('grdContacts'); var hiddenContacts = document.getElementById('hiddenContacts'); var rowCount = grdContacts.rows.length; if(rowCount > 1) { var count =1; for(; count < rowcount ; count++) { if(grdContacts.rows[count].cells[0].childNodes[0].childNodes[0].checked == true) { hiddenContacts.value += grdContacts.rows[count].cells[2].innerText + ";"; } } }
You can try with innerHTML It should work in all the browser
Best Regards, Chetan Patel
-
You can try with innerHTML It should work in all the browser
Best Regards, Chetan Patel
I need to first find my check box and if the check box is checked then i need to get the InnerText. I got the solution for the above. Modified the function as below. function ReadData() { var grdContacts = document.getElementById('grdContacts'); var hiddenContacts = document.getElementById('hiddenContacts'); var rowCount = grdContacts.rows.length; if(rowCount > 1) { var browserName=navigator.appName; for(var count =1; count