Hello!

I have a SVG element on my webpage:

 <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="93mm" height="53mm"> <rect x="0" y="0" width="100" height="100" fill="blue" stroke="red" stroke-width="5px" rx="8" ry="8" id="myRect" class="chart" /> <text x="20px" y="55px" font-family="Verdana" font-size="43pt" id="hello">Hello World!</text> </svg> 

I am trying to apply the jQuery UI Draggable effect to the text using the following jQuery line:

 $(document).ready(function(){ $('#hello').draggable(); }); 

However, nothing happens ... Tell me, please, is it possible to apply this effect to the elements of SVG graphics? Help me please.

    1 answer 1

    The problem is that the DOM specifications for HTML and SVG are partly different in ways that prevent jQuery from working properly. A number of properties of elements, having the same name, has excellent content, a number of properties present in one specification may be missing in another, for example, the innerHTML property is missing in the SVG DOM, being present in the HTML DOM.

    Therefore, in general, jQuery will not work with SVG DOM. You need to try additional plugins, for example, jQuery SVG , maybe something will work.