-2

Is this possible to append a div "mydiv" to an area shape id like below:

<area id="one" shape="rect" coords="335,239,376,282" href="#" />
user992731
  • 3,400
  • 9
  • 53
  • 83

2 Answers2

2

As area is a self closing element, it can't hold other elements.
If you append a div to an area element, most browser will try and fix your error by adding a closing </area> tag, and actually add the div inside, but it won't do much good, as the area tag only defines a certain space/area in an image, and a div has no place in an image, and the content won't be visible ?

In other words, no you can't do that!

FIDDLE

adeneo
  • 312,895
  • 29
  • 395
  • 388
  • append won't include the element. It will just sit it nicely under it. Unless i misread the OP's desired outcome? – Jamie Hutber Jul 10 '13 at 21:22
  • @JamieHutber - In Chrome it closes the area tag and appends the DIV, but the content is not visible. I added a fiddle. – adeneo Jul 10 '13 at 21:24
  • Thanks Adeneo, I am looking to achieve having a map of the U.S. and when the user rollovers over the area shape that particular div that is attached would appear. How would go you go about achieving this? – user992731 Jul 10 '13 at 21:29
  • You can not style or change the apperance of an area tag, all you can do is attach hover/mouse events to it, so when hovering the area, you change the image src etc. That's how maps like that are made. – adeneo Jul 10 '13 at 21:39
0
$('#one').append('<div id="mydiv">Something in here</div>");

I believe something like this will do the trick.

PSL
  • 123,204
  • 21
  • 253
  • 243
Jamie Hutber
  • 26,790
  • 46
  • 179
  • 291