I am trying to apply a style to the inner div which is contained in the parent div. The parent div also contains tons of other div but I just want to apply the color to the [0] div.
$("#parentDiv div")[0].css('background-color', 'red');
For some reason it says “css function is not defined!”
You might try:
Although, the
:firstselector should work.If it still doesn’t work, be sure to look at your HTML after the method has been run, to determine if the first element is really what you think it is.