I have an JS Object like
var map = {
prov1: { paper.path("M182.89887,371.5666L18,.... },
prov2: { paper.path("M182.89887,371.5666L18,.... },
prov3: { paper.path("M182.89887,371.5666L18,....}
};
now I need to assign some function to each of theses properties like
$(map.prov1).hover({
alert("You Assigned A Task to prov1");
});
in a working example it should be like
$(prov1).hover({
alert("You Assigned A Task to prov1");
});
but as you know I can not get access to $(prov1)
directly and $(map.prov1)
returns as [object object]
!
Can you please let me know how to get the name
and not the value
of the object to run the function?
I think you are trying to overcomplicate it by using jquery here, when its not needed.
You can simply do...
jsfiddle
If you needed to iterate over the object, you could do something like
jsfiddle method with iteration if needed