Try like this .trim()
will ignore the
$('td').each(function() {
if (!$(this).text().trim()) {
$(this).attr('contenteditable', true)
}
})
table,
tr,
td {
border: 1px solid #333;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td></td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td></td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
<tr><td>one</td><td> </td><tr>
</table>
0
solved How do I find empty cells or cells with   in td in table and make it editable using js and jquery