I'm trying to create a jQuery function to clone and append a text-field and select-box into the bottom of a div, like this:
$(".inline-form .copyIng:first-child").clone().appendTo(".inline-form");
$(".copyIng").trigger("create");
See this: http://jsfiddle.net/rxwL6/
But the 2 elements get's cloned twice and looks wired, any ideas why this happens?
Greeting :)
I'm sorry for answering my own question
, but the solution looks like this:
$(document).ready(function(){
$("#newIng").click(function(){
$(".inline-form .copyIng:first-child").clone().appendTo(".inline-form");
});
$("#newOve").click(function(){
$('<div class="ove"><input type="text" name="c[]" class="field" placeholder="Overskrift"></div>').appendTo(".inline-form");
$(".field").textinput();
});
});