Best way to disallow functions on table cells with class="xyz"?
I have a table where I want to allow inline editing for all td elements except those having class="noedit".
The following appears to work and only adds the background color to those cells which should be editable. I wonder if there is a better way to do this? I'm pretty new to the :not and :has selectors.
<table>
<caption>Edit-y Table </caption>
<tr>
<td class="noedit">Can't edit me<td>
<td>But you can edit me</td>
</tr>
<tr>
<td class="noedit">Can't edit me<td>
<td>But you can edit me<td>
</tr>
<tr>
<td>But you can edit me<td>
<td>But you can edit me<td>
</tr>
</table>
<script>
$( document ).ready(function() {
// console.log( "ready!" );
$("td:not(td.noedit)").css( "background-color", "yellow" );
});
</script>