내 파일에 여러 개의 <input type='file' />
필드가 있고 html이 없습니다. form
. 특정 <input type='file' />
의 첨부 파일을 정리하고 싶습니다. 모든 분야가 아닙니다. $('input').val("");
을 사용했지만 모든 <input type='file' />
필드를 지 웁니다. 그렇다면 특정 파일 (예 : <input type='file' />
)의 첨부 파일을 삭제하는 방법은 무엇입니까? 여기 jQuery 또는 JavaScript를 사용하여 <input type = 'file'/>에서 파일을 지우는 방법
var control = $("#mcontrol");
$("#clear").on("click", function() {
$('input').val("");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="file" id="mcontrol" /><br>
<input type="file" id="mcontrol2" />
<button id="clear">Clear</button>
여기 봐는 (jQuery를 사용하여) : http://stackoverflow.com/questions/1043957/clearing-input-type-file-using-jquery도 – PaTT
당신의 바이올린, 링크가 없습니다 jQuery로 첫 번째'$ '에 실패했습니다 –
jQuery를 사용하여 [ 지우기]의 복제본이있을 수 있습니다. (http://stackoverflow.com/questions/1043957/clearing-input-type-file- using-jquery) – AymDev