Build and design a table using jQuery

I have made a table in jquery but I don’t know how can I change it’s appearance like border and etc in Jquery !
also I need to change odd row’s color !

Look into using CSS nth-child(odd) as a selector for the rows of your table.

I have to do it with JQ !

Why do you have to do it with jQuery? It is better if you use CSS. Either way, you can still use the selector I mentioned with jQuery to do this.

Right, but my teacher ask me to do it with jQ

You should still use CSS for the style and not the table attributes as they are deprecated. You just target the element with Jquery and make the changes to the CSS properties like background and border.

You can also use :odd as the selector.

$('tr:odd').css('background', 'red');

1 Like