0

Help with jQuery click event to change background color

I set a div (class=“item” id=“back”) I set css with jQuery “(document).ready” It’s fine so far, the problem comes when I want to use addClass to this div after clicking another div (id=“joyas”) It goes like: $(document).ready(() => { $(“#back”).addClass(“indexback”); }); $(“#joyas”).click(function() { $(“#back”).addClass(“joyasback”); }); Notes: .indexback class has linear gradient, and I want it to change to white when clicking the div “joyas”. So the class .joyasback has a solid white background.

13th Aug 2022, 1:50 AM
BASSiT Music
BASSiT Music - avatar
1 Odpowiedź
+ 2
Can you attach the code bit link please? incomplete snippet like this make it harder to find the problem cause there are things that aren't shown. https://www.sololearn.com/post/75089/?ref=app
13th Aug 2022, 2:18 AM
Ipang