わかりました。入力オブジェクトがあります。変更すると別のオブジェクトが追加されます。クリック
すると削除(izdzēst
)リンクがあり、最後の入力フィールドが削除されます。その方法は?(削除の機能はdzest
)
問題はあると思い$(this)
ますか?
<input name="userfile[]" type="file" size=40 />
<a href="#" onclick="dzest();return false" class="link" name="dzest" style="font-weight:normal; display:none;">Izdzēst</a><br />
<script>
function dzest(){
$(this).closest('input').remove();
}
$("input[type=file]").change(function() {
$('<input name="userfile[]" type="file" />').appendTo('body');
$('<a href="#" onclick="dzest();return false" class="link" name="dzest" style="font-weight:normal; display:inline;">Izdzēst</a><br/>').appendTo('body');
$('.link').css('display','inline');
});
</script>