I have a html table with a row that looks like:
<tr>
<td><input type="checkbox" name="check[]" value="265"></td>
<td>265</td>
<td>NO MATCH</td>
<td>NO MATCH</td>
<td>No</td>
<td>0</td>
<td>f79a8316891</td>
</tr>
I am trying to build a jquery function that will highlight a cell only if it starts with "NO" . So far I have:
$( "td" ).hover( function() {
var contents = $( this ).html() ;
if (contents.match("^NO")) {
function() {
$( this ).append( $( "<span> ***</span>" ) );
}, function() {
$( this ).find( "span:last" ).remove();
}
}
});
But I'm getting the error in the title. What am I doing wrong?
hover()function is way off. What exactly are you trying to do?function() {supposed to do there?ifstatement. This is bad because JavaScript doesn't have block scope for defining functions.