How to fetch the content of the next td when the check box is clicked
Solution 1:
This seems to work, though it's very HTML-dependant (as is much JavaScript that involves DOM-traversal, of course):
var c = [];
c = window.document.getElementsByTagName('input');
for (var i = 0; i < c.length; i++) {
if (c[i].type == 'checkbox') {
c[i].onchange = function() {
if (this.checked){
console.log(this.parentNode.nextElementSibling.firstChild.nodeValue.trim());
}
};
}
}
Post a Comment for "Fetch Content Of Next Td On Checkbox Click"