3

i need to get 'svg' element inside 'object'. Normally we can use $("object").find('svg') but the problem is the presence of #document.

I also tryed maybe every combination of $( "#id" ).contents().find('svg') or again $($("object").get(0)).find('svg') ,

and believe me, many more....

Thx in advice for help.

html code:

<object data="./images/image.svg" type="image/svg+xml" class="class-svg" id="id">
 </object>
  • This is a very common question, please use Google first before asking a question. – Dom Oct 29 '13 at 22:07
  • 2
    possible duplicate of [jQuery Selector + SVG Incompatible?](http://stackoverflow.com/questions/3294553/jquery-selector-svg-incompatible) – Dom Oct 29 '13 at 22:11
  • And you think i posted in stackoverflow after about 30 tries without google combinations of this query? I ended up to use a plugin, i don't want to use a plugin and nor mix jquery-javascript. – Alessio Lunardelli Oct 29 '13 at 22:14

1 Answers1

0

SVG Document Object Model (DOM) is lot more different from HTML Document Object Model (DOM). Therefore it will not work same as with the HTML DOM.

It is possible to use jquery-svg plugin for the implementation.

https://github.com/mberneti/jquery-svg/

Saveendra Ekanayake
  • 3,153
  • 6
  • 34
  • 44