0
我試圖創建一個jQuery函數框中選擇克隆和追加一個文本字段,並進入一個div的底部,像這樣:jQuery的克隆和觸發創建
$(".inline-form .copyIng:first-child").clone().appendTo(".inline-form");
$(".copyIng").trigger("create");
看到這個:http://jsfiddle.net/rxwL6/
但是,這兩個元素得到了克隆兩次,看起來有線,任何想法,爲什麼會發生這種情況?
問候:)
我回答我自己的問題
遺憾,但解決的辦法是這樣的:
$(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();
});
});
是不是你想要什麼http://jsfiddle.net/rxwL6/2/? – YD1m
沒錯,但後來當我添加一個文本字段時,我需要觸發創建。 – Sims