The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> change text in text class
MikeAngel
post Aug 2 2020, 03:01 PM
Post #1





Group: Members
Posts: 2
Joined: 2-August 20
Member No.: 27,471



So, I am trying to change a text in a svg class from code. I tried various stuff like document.getElementById(element).innerHTML and else but it seems to not work.

this is the code I am having:

CODE

        <svg class="Rechteck_4">
            <rect id="Rechteck_4" rx="7" ry="7" x="0" y="0" width="477" height="79"></rect>
            <text x="138" y="50" vertical-align='middle' text-align='left' font-family="Verdana" font-size="35" fill="white">000000000</text>
        </svg>


I tried the document .text class the .innerText class the value and more but it seems to wont work.. any ideas?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
MikeAngel
post Aug 2 2020, 03:13 PM
Post #2





Group: Members
Posts: 2
Joined: 2-August 20
Member No.: 27,471



well, I fixxed it with using jQuery..
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
CharlesEF
post Aug 2 2020, 04:39 PM
Post #3


Programming Fanatic
********

Group: Members
Posts: 1,981
Joined: 27-April 13
From: Edinburg, Texas
Member No.: 19,088



Well, your description of the problem is very much lacking any details. I can look into my crystal ball and see that the SVG tag has no id attribute so getElementById() won't work. Or are you trying to change some other element text?

Sorry, switching to jQuery didn't really fix anything. Yes, you got it working but you really didn't fix anything.

This post has been edited by CharlesEF: Aug 2 2020, 04:40 PM
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 19th March 2024 - 03:08 AM