开发者

Jquery selector with svg

I'm manipulating an svg and I'd like to access the elements by jquery and his selectors but they doesn't seem to work: all the other functions like getJSON and .ajax work witho开发者_如何转开发ut any problem.

The browser load a file.svg, not an html page with svg contents in it. How do I change the value of this text element for example? (this node is a root child)

<text id="green_nick"  class="nickname" x="1200" y="279" onclick="takeSeat(evt)">a234567890a2345</text>

// this doesnt work
$.("#green_nick").val("changeit!")


As SVG uses non-standard elements, it can't be manipulated like DOM elements. You should look at jQuery SVG to manipulate SVG Elements.


jQuery SVg is the solution if you have a little time for a short learning curve that delivers a lot Convert your SVG into Kieth's jQuery SVG. You cam add a jQuery SVG Lin from his package which allows you to control the Dom Also view the "matrix" chart on the converter

http://irunmywebsite.com/raphael/SVGTOHTML_LIVE.php

Choose the 3rd option on the dropdown as the first 2 are for another SVG library

You will find the Matrix info that complements the above information to control the Dom

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜