Using jQuery to change background of parent also changes the background of the child element

Using jQuery to change background of parent also changes the background of the child element
0

#1

$("#target1").parent().css(“background-color”,“red”);


#2

CSS ---- CASCADING style sheet

Keyword: Cascading… down the line…

Just apply a separate background-color to the child element.