여러 입력 유형 파일이 있습니다. 기본적으로 숨겨져 있으며 첫 번째 항목 만 표시됩니다. 사용자가 첫 번째 입력 파일이있는 파일을 선택하면 아래 기능은 id로 다음 입력 파일을 보여줍니다. 문제는 첫 번째 2 변경 이벤트에만 적용되고 오류없이 중지하는 것입니다. 어떻게 다음 입력 파일마다 작동하게 할 수 있습니까?Jquery 입력 유형 파일이 트리거로 작동하지 않습니다.
여기//first we hide all inputs
$('.imagediv').hide();
$('.imagediv:first').show();
var nextupload=$('.imagediv:first').attr('data');
nextupload=(parseInt(nextupload) + 1);
//this is the event
$(function() {
$("input:file").change(function(){
var nextf = $(this).attr('data');
$('#input'+(nextupload)+'').show();
alert('#input'+(nextupload)+'');
});
});
는 HTML의 모습 방법은 다음과 같습니다 : 여기에 기능입니다
<div class="imagediv" id="input2" data="2">
<input type="file" name="gallery_upload_2" data="gallery_upload_3" id="gallery_upload_2" />
</div>
등 다음 입력으로는 .. 는 어떻게 모든 다음 입력 변화를 작동하게하는? 감사합니다
는 여기 jsfiddle했다 : http://jsfiddle.net/Lbu3ksjh/1/
는 $ ("입력 : 파일") 대신이 사용 $ ("#의 gallery_upload_2") –
어떤 것 이 변화? 나는 이벤트를 놓치고 있지 않다. $ ("input : file")을 사용하여 잘 작동하지만, 단지 2 번만 실행한다. – Europeuser