How to make paragraphs appear per click one after the other? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make paragraphs appear per click one after the other?

I am working on the interactive fiction game which consists of multiple paragraphs one after the other...I want each paragraph to be visible with a click. I know that the code is:-(CSS) .p{ visibility:none;} and then by using script to modify none to block on click but this gets applied for all the paragraphs. how to make the para appear per click one after the other?

21st Nov 2017, 1:54 AM
Pradeep Suresh
Pradeep Suresh - avatar
7 Answers
+ 2
JS can get a list of all paragraphs with getElementByTag and modify them one at a time setting it to be displayed.
21st Nov 2017, 4:27 AM
John Wells
John Wells - avatar
+ 3
We rarely use visibility, most time use display to control add/remove element div
21st Nov 2017, 7:57 AM
Calviղ
Calviղ - avatar
+ 1
Let's take a lot of your code...
21st Nov 2017, 2:44 AM
Calviղ
Calviղ - avatar
+ 1
Actually, it could be completely JS. You can add any HTML tags in JS. I add table rows in this program. https://code.sololearn.com/W0SpGiJ3Vfzb/?ref=app
21st Nov 2017, 4:22 AM
John Wells
John Wells - avatar
+ 1
I'm a newbie and am actually using twine 2 for that interactive fiction game so a bit confused with the script side. Thanks Sir!!
21st Nov 2017, 4:38 AM
Pradeep Suresh
Pradeep Suresh - avatar
+ 1
If you wish some help understanding the code, put some in a code in your account. Link it here and I will explain what is going on via comment on it.
21st Nov 2017, 4:46 AM
John Wells
John Wells - avatar
0
finally I found out the problem ,😹 I was using visibility instead of display and then another error was gelelementsbyid instead of getelementbyid... Here is the format I have built:- https://code.sololearn.com/WRIury3u3sm2/?ref=app
21st Nov 2017, 7:42 AM
Pradeep Suresh
Pradeep Suresh - avatar