Description text? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Description text?

How do you make a text that when clicked shows information?

19th Apr 2017, 12:45 PM
Ulises Zagare
Ulises Zagare - avatar
5 Answers
+ 7
<!DOCTYPE html> <html> <head> <meta charset = "UTF-8" name = "viewport" content = "width = device-width, initial-scale = 1.0"> <title>Text description</title> </head> <body> <p style="color:red" onclick="describe()">text to describe</p> <script> function describe(){ var p = document.querySelector("p"); p.innerHTML = "description"; } </script> </body> </html>
19th Apr 2017, 6:25 PM
Emore Anzolin
Emore Anzolin - avatar
+ 6
I think you mean with HTML. You can use an hyperlink to a description page. Or with JavaScript add an event listener to a paragraph to change the innerHTML of the tag and add the description. Describe better what you would like to do?
19th Apr 2017, 5:39 PM
Emore Anzolin
Emore Anzolin - avatar
0
And a text that clicks the description below?
19th Apr 2017, 5:41 PM
Ulises Zagare
Ulises Zagare - avatar
0
tanxx at the two
19th Apr 2017, 6:30 PM
Ulises Zagare
Ulises Zagare - avatar
0
:)
19th Apr 2017, 6:30 PM
Ulises Zagare
Ulises Zagare - avatar