나는 선택한 이미지의 미리보기 이미지를 표시하기위한 이미지 미리보기 div가 있습니다. 지금까지는 잘 작동합니다. 하지만 사용자가 업로드 할 이미지를 선택할 때 페이지가로드되고 표시 될 때이 div를 숨기고 싶습니다. heres는 내 코드의 구조 :이미지를 선택할 때 미리보기 div 표시
<div class="fileinput fileinput-new" data-provides="fileinput">
<div class="fileinput-preview thumbnail" data-trigger="fileinput" style="width: 200px; height: 150px; display:none"></div> #This is the div for previewing images
<div>
<span class="btn btn-info btn-file">
<span class="fileinput-new">Select image</span>
<span class="fileinput-exists">Change</span>
<input type="file" name=""></span>
Heres는 내 JQuery와 : 내가 그것을 할 것이라고 생각했던 (jQuery로 그 첫 시간)
<script type="text/javascript">
$(document).ready(function(){
$(".btn btn-info btn-file").click(function(){
$(".fileinput-preview thumbnail").show();
});
});
</script>
jsFiddlehttp://jsfiddle.net/3717h5mg/1/
것은이 작동하지 않습니다.
'$를 (". btn.btn-info.btn 파일")'과'$ (".fileinput-preview.thumbnail"). show();'클래스 선택자 사이의 공간을 제거하십시오. – Abhitalks
그게 도움이 안된다 !! – catastropic
왜 안 되니? 여기를 참조하십시오 : http://jsfiddle.net/abhitalks/354k5wh6/ – Abhitalks