Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×

Checkbox make disapear a text

Hello, i try to create 5 line who disapear when the check box is unchecked. and i try along time and i can make it so can you help me?  <!DOCTYPE html > <html> <body> <p> Display some text when the checkbox is checked: </p> <label for ="myCheck" > Checkbox: </label> <input type ="checkbox" id ="myCheck" onclick ="myFunction()" > <p id ="attr" style ="display:none" > Checkbox is CHECKED! </p> <script> function myFunction() { var checkBox = document.getElementById("myCheck"); var text = document.getElementById("attr"); if (checkBox.checked == true){ attr.style.display = "block"; } else { attr.style.display = "none"; } } </script> </body> </html>
1675576034

Edited 1675579622
GiGs
Pro
Sheet Author
API Scripter
In Roll20 you can only change attribute values with sheet workers. You cannot do any of the changes you might be able to do on other websites, so web help can often lead you astray. Your code looks like it was built from an external help page, and almost all of it does not work on Roll20. Also the html and body tags should not be used. The HTML you create is only for part of the entire HTML page - roll20 already has its own HTML and Body tags. Here's the HTML you need < p class= "toggle-display" > Display some text when the checkbox is checked: </ p > < label for= "myCheck" > Checkbox: </ label > < input id = "myCheck" type= "checkbox" class= "check" name= "attr_myCheck" value= "1" > And on the CSS page input [ type = "checkbox" ] .check:not ( :checked ) ~ p.toggle-display {     display : none ; } Try that. The key is the class labels you assign, and targetting those with CSS.
Thanks for your help.  I'm french and i try to undertand the wiki but not always easy.  Now it's still din't work  My final goal is to make disapere these 5 line when i check
1675676626

Edited 1675676744
GiGs
Pro
Sheet Author
API Scripter
I tried it and it worked for me, so there must be something different in your html. Post the entire html for that picture, and say what you want to be hidden. Also, if language is making reading the wiki hard, this might not help, but you can try it anyway: Hide With CSS
is that i try to make hidden
1675681725

Edited 1675681932
It's work !!!! With the links i undersatnd my mistake!! It's take 30 minute to understand but now it's good you're the best Thanks a lot for you help 
1675715752

Edited 1675747107
GiGs
Pro
Sheet Author
API Scripter
Great! For the future, please dont share a picture of text, share the text. I'm being curt to help translation.
Okay, i will do that so