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


Groups > comp.lang.javascript > #33685

Re: Cloning a table and not allowing click anywhere to trigger this event

Newsgroups comp.lang.javascript
Subject Re: Cloning a table and not allowing click anywhere to trigger this event
From "Evertjan." <exxjxw.hannivoort@inter.nl.net>
References <441c01c2-320f-47e9-a386-28b4b598f692@googlegroups.com> <6a61845c-26e6-44d3-8e2c-ca8e4a35b833@googlegroups.com> <ce7d333c-2102-4456-833c-3341032c75f9@googlegroups.com>
Date 2017-08-03 11:27 +0200
Message-ID <XnsA7C6749794CBFeejj99@194.109.6.166> (permalink)

Show all headers | View raw


justaguy <lichunshen84@gmail.com> wrote on 03 Aug 2017 in
comp.lang.javascript: 

>> > </table>
>> 
>> Never mind, solved.  append any new child to a fake div below it,
>> that's it.

"Fake" is so very Trumpian!

What about:

<script type='text/javascript'> 
'use strict';
function duplicateAfter(t) {
  t.insertAdjacentElement('afterend',t.cloneNode(true));
};
</script>

<table onclick='duplicateAfter(this);'>
<tr><td>Blah
</table>

Warning: any id will be illegally duplicated too!

> But it would be good to know if we have a way to copy elements structure
> only instead of default elements and their respective values.

Elements have content, do you mean that? 

You would have to insert the new content anyway,
so replacing content would do fine.

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

Cloning a table and not allowing click anywhere to trigger this event justaguy <lichunshen84@gmail.com> - 2017-08-02 13:53 -0700
  Re: Cloning a table and not allowing click anywhere to trigger this event justaguy <lichunshen84@gmail.com> - 2017-08-02 15:45 -0700
    Re: Cloning a table and not allowing click anywhere to trigger this event justaguy <lichunshen84@gmail.com> - 2017-08-02 21:29 -0700
      Re: Cloning a table and not allowing click anywhere to trigger this event "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-03 11:27 +0200
        Re: Cloning a table and not allowing click anywhere to trigger this event justaguy <lichunshen84@gmail.com> - 2017-08-03 11:34 -0700
          Re: Cloning a table and not allowing click anywhere to trigger this event justaguy <lichunshen84@gmail.com> - 2017-08-04 12:50 -0700
            Re: Cloning a table and not allowing click anywhere to trigger this event justaguy <lichunshen84@gmail.com> - 2017-08-04 14:00 -0700
        Re: Cloning a table and not allowing click anywhere to trigger this event justaguy <lichunshen84@gmail.com> - 2017-08-04 19:06 -0700
          Re: Cloning a table and not allowing click anywhere to trigger this event "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2017-08-05 10:38 +0200
  Re: Cloning a table and not allowing click anywhere to trigger this event JR <jrfaqcom@gmail.com> - 2017-08-05 13:07 -0300

csiph-web