프로그램/jQuery

Input TYPE=“File” 을 히든으로 하고 외부 버튼을 눌러서 파일을 선택

로드러너 2014. 7. 24. 17:13

<script type="text/javascript">

$(function () {

$('#btn-upload').click(function (e) {

e.preventDefault();

$('#file').click();

});

});

    

            function changeValue(obj){

            alert(obj.value);

            }

</script>


<style type="text/css">

#file { display:none; } 

</style>


<div>

<input type="file" id="file" name="file" onchange="changeValue(this)"/>

<button type="button" id="btn-upload">Image</button>

</div>




참조Input TYPE=“File” hide the input and leave the button?