Avatar of mhas01
Flag for Costa Rica asked on

how to hide <div> in html or prevent an <input type='text'> from being printed

Hi experts.

As the title of the question states, I need to understand by examples:

how to hide a <div> element in html

and also I need to prevent an <input type='text'> from being printed (maybe putting it inside another div element)

DYNAMICALLY, and using Javascript maybe leveraging css styles and JQuery would be preferable.

Thanks in advance
Web DevelopmentHTMLjQuery

Avatar of undefined
Last Comment
Ovid Burke

8/22/2022 - Mon
Jason C. Levine

<div style="display: none"></div>

That will hide the div and contents from being displayed.  To assign it via javascript or jquery you just use whatever event you want to trigger it and assign the preferred style to the preferred object.

<div style="display: none"></div> will disappear the div tag
<div style="visible: false"></div> will hide the content of the div tag

you can call these using javascript
Use document.getElementById('id')

Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Jon Norman

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.