changing text in svg by jquery (text is an dynamically value - temperature) -


i'd change text-part of svg:

<text id="vl_temp" xml:space="preserve" style="font-size:40px;font-style:normal;font-weight:normal;line-height:100%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:sans;-inkscape-font-specification:sans;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr" x="432.24234" y="110" sodipodi:linespacing="100%">**--**</text> 

i'd display temperature, comes knx-installation i've tried following code, nothing happens:

   <script> <![cdata[ var thisga = '14/0/4'; var thistransform = 'dpt:9.001'; visu = new cometvisu('/cgi-bin/'); visu.update = function ( json ) {   var temp = transform[thistransform].decode( json[thisga] );   $('#vl_temp', svg.root()).text('temp'); } $(window).unload(function() {   visu.stop(); }); visu.user = 'demo_user'; visu.subscribe( [thisga] ); ]]> 

whats problem line starting $('#vl_temp'? rest of code seems ok, because part works in svg jquery (svn-link svg)

the <text> tag svg should contain <tspan> tag , text should in <tspan> tag, this:

<text id="vl_temp" xml:space="preserve" style="" x="432.24234" y="110" sodipodi:linespacing="100%"><tspan>**--**</tspan></text> 

the code needs updated well:

$('#vl_temp tspan', svg.root()).text('temp'); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -