I need to build a very simple piece of code for when you click a <td>
it will turn black but when you click it again it will turn white.
$(document).ready(function(){
$("td").click(function(){
if($(this).css('background-color') != 'black'){
$(this).css('background-color', 'black');
}
else if($(this).css('background-color') === 'black'){
$(this).css('background-color', 'white');
}
});
});
With this code it will turn black but wont turn white again.