JavaScript, getting value of a td with id name
javascript
Solution
To get the text content
document.getElementById ( "tdid" ).innerText
or
document.getElementById ( "tdid" ).textContent
var tdElem = document.getElementById ( "tdid" );
var tdText = tdElem.innerText | tdElem.textContent;
If you can use jQuery then you can use
$("#tdid").text();
To get the HTML content
var tdElem = document.getElementById ( "tdid" );
var tdText = tdElem.innerHTML;
in jQuery
$("#tdid").html();
Problem
Originally I was using input with an id and grabbing it's value with getElementById. Currently, I'm playing with `<td>`s. How can I grab the values of the `<td>`? Originally I used: ``` <input id="hello"> document.getElementById("hello").value; ``` Now I want to get value of `<td>`, but I don't know how; ``` <td id="test">Chicken</td> <td>Cow</td> ``` Edit: What's the difference between `textContent`, `innerHTML`, and `innerText`?