Avatar of mhas01
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.
wdfdo1986

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

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

http://www.w3schools.com/htmldom/dom_nodes_access.asp
http://www.w3schools.com/jsref/dom_obj_node.asp
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
ASKER CERTIFIED SOLUTION
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
or
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
SOLUTION
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.