I want to hide a table row when a td has no value, but my javascript function is failing. It keeps going on the "else".
HTML
<table>
<tr id="locOfWorkRow">
<td><span>Location of Work</span></td>
</tr>
<tr>
<td><span>This is the label</span></td>
<td id="road"><span></span></td>
</tr>
</table>
Javascript
var r = document.getElementById('road').innerHTML;
if(r == ""){ alert("on if");
document.getElementById('locOfWorkRow').style.display = "none";
}else{
alert("on else");
}