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


Groups > comp.lang.javascript > #32457

Re: Putting something into DOM without being visible

Newsgroups comp.lang.javascript
Subject Re: Putting something into DOM without being visible
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <de3d6f50-86f4-415e-bb79-53d3dc61e5b8@googlegroups.com> <q7smb4wfv5zs.1ohk2cs4qorla$.dlg@40tude.net>
Date 2017-02-03 12:57 +0100
Message-ID <XnsA71183BD27AB3eejj99@194.109.6.166> (permalink)

Show all headers | View raw


JJ <jj4public@vfemail.net> wrote on 03 Feb 2017 in comp.lang.javascript:

> On Thu, 2 Feb 2017 11:35:42 -0800 (PST), bit-naughty@hotmail.com wrote:
>> 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?
>> 
>> Thanks.
> 
> Or process the AJAX result and build the elements, but don't append the
> their container into the DOM tree until it's actually needed to be shown.

Or try this, 
where image-element 'q' is removed from the DOM-tree 
but kept available for later reinsertion:

<body>

<img id=q src='myImage.jpg'>

<script type='text/javascript'> 'use strict'

	let q = document.getElementById('q');
	let b = q.parentNode; // = document.body
	
	window.setTimeout('b.removeChild(q);',2000);
	window.setTimeout('b.appendChild(q);',5000);

</script>



-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

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