Click here to Skip to main content
15,561,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sweet day for all

my Question is i need to make map in java script language when the mouse curser enter the region path the background color has changed

how can i do this or give me a site can help me

Thanks && Best Regards 4 All

1 solution

The only good style of defining colors is CSS. Therefore, the only good way to do this in JavaScript is changing or adding the style of the element. And one of the most convenient way of doing this is using jQuery:[^],[^].

You can use the jQuery .addClass, .removeClass or .toggleClass methods:
myElement = $("#myElement"); //find element where the element is marked with id="myElement" in HTML
className = "yellowBackground";

myElement.addClass(className); //make red
myElement.removeClass(className); //restore previous classes and hence CSS properies


myElement.toggleClass(className); //toggle it

Naturally, you would need the correspondent classes in CSS:
.yellowBackground { background-color: yellow; }

Please see:[^],[^],[^].

Learning jQuery is easy and a kind of fun. Start here:[^],[^].

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900