- jQuery 업로드 파일 추가
1 예시[ | ]
html
Copy
<script src="//code.jquery.com/jquery-2.1.1.min.js"></script>
<script>
$(function(){
$('#button-add-file').click(addFileForm);
$(document).on('click', '.button-delete-file', function(event) {
$(this).parent().remove();
});
});
var count = 0;
function addFileForm() {
var html = "<div id='item_"+count+"'>";
html += "<input type='file' name='fileup[]' />";
html += "<button class='button-delete-file'>삭제</button></div>";
count++;
$("#my-form").append(html);
}
</script>
<button id='button-add-file'>파일 추가</button>
<form id='my-form'></form>
2 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.