Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32448

Re: Putting something into DOM without being visible

From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: Putting something into DOM without being visible
Date 2017-02-02 20:01 +0000
Organization A noiseless patient Spider
Message-ID <87h94cl5vm.fsf@bsb.me.uk> (permalink)
References <de3d6f50-86f4-415e-bb79-53d3dc61e5b8@googlegroups.com>

Show all headers | View raw


bit-naughty@hotmail.com writes:

> If someone clicks a button, I want to download stuff with AJAX, and
> then, I guess, append it to the DOM tree. But I DON'T want it to be
> visible straightaway - I'll make it visible later. What do I do?

You have lots of options.  The simplest is probably to use "display:
none" or "visibility: hidden".  See [1] for the difference -- it's not
clear which you mean.  Other ways to hide elements (such as positioning
them outside of the viewport) have too many problems to be worth
recommending.

To change the view you can switch the property directly on the elements
(or on a container element), or you can use classes.

Remember to consider the impact on accessibility if this is going to be
used by others.

[1] https://www.w3.org/TR/2011/REC-CSS2-20110607/propidx.html

-- 
Ben.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Putting something into DOM without being visible bit-naughty@hotmail.com - 2017-02-02 11:35 -0800
  Re: Putting something into DOM without being visible Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-02 20:01 +0000
  Re: Putting something into DOM without being visible JJ <jj4public@vfemail.net> - 2017-02-03 17:41 +0700
    Re: Putting something into DOM without being visible "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-03 12:57 +0100
  Re: Putting something into DOM without being visible Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2017-02-03 13:22 +0100
  Re: Putting something into DOM without being visible bit-naughty@hotmail.com - 2017-02-05 05:03 -0800
    Re: Putting something into DOM without being visible "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-02-05 19:14 +0100

csiph-web