I want to add background color to text with code

I managed to add toggle’able additional text into my main text. Is there a possibility to change the background of the toggle text? I searched the code API explanations, but when i use that code, the word style is underlined red, as if there was a mistake in it.
Here is the line i put into my code:

   $w('#Dproc01').style.backgroundColor = "#FF000000"; 

I am a newbie in wix API, sorry for that :slight_smile:

What kind of element is $w(’ #Dproc01 ')? On a text element you can use the HTML property to get than through code. use the .html = “your text here

Read more

Thanks, but your solution makes my text invisible.
#Dproc01 is i guess a text element? As in the Wix visual editor i have the option “Edit text”, but nothing else.
When i look at the source in browser its:

my text

Well you need to format everything when using html so set color=‘#000000’ if you want it balck and so on. All formatting get lost when you use HTML.
your text here

If i use html, then all formatting is lost and sadly also this span replaces the p i have entered via wix visual editor…

Well it is not perfect… sorry

Looking at source code from browser i see, that the text i have entered via Wix visual editor is inside a div. And i manage to toggle that div open and close. How come i am not able to change the style of that div through code?
I still think it should be possible somehow…