Example 1 — Official $("td:empty")
Find empty cells and write a placeholder into them.
$("td:empty").text("Was empty!");
$("#out").text(
"Filled cells: " + $("td:contains('Was empty!')").length
); How It Works
- Select.
$("td:empty")finds cells with no children. - Write.
.text("Was empty!")fills only that set. - Skip. Cells that already had text stay unchanged.

