jQuery - remove background-color when an element is visible

0 votes

I would like to remove the background-color (only the background-color) of the menu once another element is visible. I wrote this code, but it doesn't work - anybody can help?

$(function() {
if($("#wrapperHome").is(":visible")) {
    $("#menu a").css({ "background-color", "black" });  
}
});

The menu has this background style sheet information.

background:url(img/official/menu.png) center center no-repeat #f2f2f7;

Jun 7, 2022 in JQuery by Edureka
• 13,690 points
3,216 views

1 answer to this question.

0 votes

$("#menu a"). css("background-color", ""); Setting the background-color to "" essentially removes the styling, removing the color.

answered Jun 7, 2022 by Edureka
• 13,690 points

Related Questions In JQuery

0 votes
1 answer

How do I check if the mouse is over an element in jQuery?

Hello @kartik, Use this code: $("someelement").mouseenter(function(){ ...READ MORE

answered Oct 5, 2020 in JQuery by Niroj
• 82,840 points
2,349 views
0 votes
1 answer

How can I select an element with multiple classes in jQuery?

Hello @kartik, If you want to match only ...READ MORE

answered Sep 10, 2020 in JQuery by Niroj
• 82,840 points
3,444 views
0 votes
1 answer

Is there an easy way to convert jquery code to javascript?

To toggle a class to an html ...READ MORE

answered Jun 16, 2022 in JQuery by rajatha
• 7,680 points
839 views
0 votes
1 answer

jQuery Animate not working on background-color property

The background color animate can be performed ...READ MORE

answered Jun 16, 2022 in JQuery by rajatha
• 7,680 points
706 views
0 votes
1 answer

How to use jquery with asp.net ajax?

If you weren't aware, Microsoft is planning ...READ MORE

answered Oct 15, 2018 in IoT (Internet of Things) by Annie97
• 2,160 points
746 views
0 votes
1 answer

Is 'sparkline' a method?

I suggest you to check 2 things That jquery.sparkline.js is actually ...READ MORE

answered Nov 9, 2018 in Apache Spark by Frankie
• 9,830 points
1,269 views
0 votes
1 answer

What is jQuery?

Hey, jQuery is a fast and concise JavaScript ...READ MORE

answered Feb 14, 2020 in JQuery by kartik
• 37,520 points
1,315 views
0 votes
1 answer

Error: Global Variable is not accessable to local function

Hey kartik, A variable declared outside a function has a ...READ MORE

answered Feb 19, 2020 in PHP by Niroj
• 82,840 points
1,086 views
0 votes
1 answer

How do you make an element "flash" in jQuery

If all you want is that yellow ...READ MORE

answered Jun 1, 2022 in JQuery by Edureka
• 13,690 points
2,405 views
0 votes
1 answer

How can I remove an attribute with jQuery?

The removeAttr() method is an inbuilt method in jQuery ...READ MORE

answered Jun 2, 2022 in JQuery by Edureka
• 13,690 points
9,500 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP