javascript - How can I remove the input before cloning a div? -
i've found few answers question on stack overflow, it's not working me. @ moment, code looks (i removed other divs it's not long read) : <div id="dynamicinput"> <div id="duplicater"> <input type="text" placeholder="event title" name="title"> <input type="text" placeholder="url" name="url"> </div> </div> and javascript : var = 0; var original = document.getelementbyid('duplicater'); function duplicate() { var clone = original.clonenode(true); clone.id = "duplicate" + ++i; original.parentnode.appendchild(clone); } it works great, if put text before pressing button "add event", clones text, , don't want that. i've tried add .find('input').val('') on first line, it's not working, can't clone anymore. error in console method find not found . the same thi...