Selecting one element to change another

Selecting one element to change another

Hi, first post here!

Let's say I want to select one element with an id of #myelement and a class of .active and then apply css changes to another element, say #thatelement

So psuedocode mixed with real code I'm thinking something along the lines of :

if ( $('#myelement.active') ) then $('#thatelement').css('background-color','green')

Sorry if I made mistakes in that code, still trying to grasp javascript/jquery. Any idea how to say if the first element is true then make the css changes to the other element?