I need to define a div\'s background color on :hover with jQuery, but the following doesn\'t seem to work:
$(\".myclass:hover div\").css(\"background-color\
Well, you can't add styling using pseudo selectors like :hover, :after, :nth-child, or anything like that using jQuery.
If you want to add a CSS rule like that you have to create a element and add that :hover rule to it just like you would in CSS. Then you would have to add that element to the page.
Using the .hover function seems to be more appropriate if you can't just add the css to a stylesheet, but if you insist you can do:
$('head').append('')
If you want to read more on adding CSS with javascript you can check out one of David Walsh's Blog posts.