I'm new to javascript , I've lot of checkboxes and recently I decided to put those inside a table which will look it more prettier ,( one question per check box inside a table cell ).
I'm working on a code which can check if on a specific cell , particular question / checkbox is check or not. And do something if that is checked .
Here is the sample HTML code :-
<tr id ="row2">
<td><div>Disable Auto Save : <input type="checkbox" name="disautosave" value="disableauto" id = "disableauto"></div></td>
<td><div>Enable Stack Monitoring : <input type="checkbox" name="stackmon" value="enablestackmon" id = "enablestackmon"></div></td>
<td>3</td>
And here is the Javascript code , if I use the alert here , it just pop up and alert with "Disable Auto Save :" which is the content of the cell
var Row = document.getElementById("row2");
var Cells = Row.getElementsByTagName("td");
alert(Cells[0].innerText);
However , I was looking for the checkbox value , i.e. to check if checkbox on that given cell is checked or not. I tried the below code ...but its not working.
if (Cells[0].checked){
alert("Checked");
//alert(Cells[1].innerText);
}