Guys, how to replace paragraph text with variable value after using function in html? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Guys, how to replace paragraph text with variable value after using function in html?

I need the text of the paragraph to change to the value of the variable when the button is pressed

13th Dec 2020, 9:28 PM
stustom
stustom - avatar
6 Answers
+ 1
All the time I entered the name of the variable and not the id, so I am very grateful to you
13th Dec 2020, 10:01 PM
stustom
stustom - avatar
0
What about <button onclick=...
13th Dec 2020, 9:39 PM
Václav Dostál
Václav Dostál - avatar
0
I know about functions, I asked how to replace the text of a paragraph with the value of a variable
13th Dec 2020, 9:46 PM
stustom
stustom - avatar
0
Then in script define variable and use it in onclick to innerHTML
13th Dec 2020, 9:51 PM
Václav Dostál
Václav Dostál - avatar
0
Ok, thanks
13th Dec 2020, 9:57 PM
stustom
stustom - avatar
0
You are welcome. Sometimes we programmers or coders need rest...
14th Dec 2020, 4:54 PM
Václav Dostál
Václav Dostál - avatar