Link to home
Start Free TrialLog in
Avatar of mhas01
mhas01Flag 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
Avatar of Jason C. Levine
Jason C. Levine
Flag of United States of America image

<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')

http://www.w3schools.com/htmldom/dom_nodes_access.asp
http://www.w3schools.com/jsref/dom_obj_node.asp
ASKER CERTIFIED SOLUTION
Avatar of Jon Norman
Jon Norman
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial