Cloning an element and adding it to Dom multiple times

Posted by Praveen Prasad on Stack Overflow See other posts from Stack Overflow or by Praveen Prasad
Published on 2010-03-16T05:58:14Z Indexed on 2010/03/16 6:06 UTC
Read the original article Hit count: 209

Filed under:
|
//I am cloning a dom element and inserting it in dom element multiple times

    <div class='toBeCloned'>some text</div>
    <div id='target'></div>

    var _clone=$('.toBeCloned').clone(true);//create clone
    var _target=$('#target'); //this is target

    _target.append(_clone); //append target
    _target.append(_clone); //append target
    _target.append(_clone); //append target

//this should add 3 elements but it's adding only one

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript