I have a table with cells which share the same id="spot"
. I would like to change all these cells.
<table>
<tr>
<td id="spot">1</td>
<td>2</td>
</tr>
<tr>
<td id="spot">3</td>
<td>4</td>
</tr>
</table>
// 1 2
// 3 4
Please tell me the difference between $("td#spot")
and $("#spot")
as the following lines of code don't produce the same result.
$("#spot").each(function (item) {
$(this).text("0");
})
// 0 2
// 3 4
$("td#spot").each(function (item) {
$(this).text("0");
})
// 0 2
// 0 4