Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
143
rated 0 times [  150] [ 7]  / answers: 1 / hits: 16360  / 11 Years ago, sat, december 7, 2013, 12:00:00

I have an HTML page with some paragraphs which I would like to show or hide via Javascript. What should I do? Do I have to use the display property in the CSS file too?
Thank you



EDIT: Since the paragraphs will be the error messages of a form, I'd like that at the beginning none of them were visibile.


More From » hide

 Answers
10

You can do like this :



To hide :



document.getElementById(elementId).style.display = 'none';


To show:



document.getElementById(elementId).style.display = 'block';

[#73864] Thursday, December 5, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jonathoncamrynv

Total Points: 339
Total Questions: 98
Total Answers: 98

Location: Saint Vincent and the Grenadines
Member since Thu, Oct 15, 2020
4 Years ago
;