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

Path csiph.com!aioe.org!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Ben Bacarisse <ben.usenet@bsb.me.uk>
Newsgroups comp.lang.javascript
Subject Re: Putting something into DOM without being visible
Date Thu, 02 Feb 2017 20:01:01 +0000
Organization A noiseless patient Spider
Lines 22
Message-ID <87h94cl5vm.fsf@bsb.me.uk> (permalink)
References <de3d6f50-86f4-415e-bb79-53d3dc61e5b8@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain
Injection-Info mx02.eternal-september.org; posting-host="df9b8a2284473f75d1c1a4bbf4c6cfe4"; logging-data="18365"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+CWeoccmTf2AaTxmfwTOoD8LDBcKqGpsw="
Cancel-Lock sha1:JVVGxPKGmK59YBoMUMkrCUUDiN8= sha1:mrvNUS7oYIZut99RnCjLOey99Y0=
X-BSB-Auth 1.d8ac1f5843fd7a6c1d81.20170202200101GMT.87h94cl5vm.fsf@bsb.me.uk
Xref csiph.com comp.lang.javascript:32448

Show key headers only | 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