Please take a look at the sample JS code below:
function readURL(input) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah').attr('src', e.target.result);
}
reader.readAsDataURL(input.files[0]);
}
}
$("#imgInp").change(function(){
readURL(this);
});
and the associated HTML:
<form id="form1" runat="server">
<input type='file' id="imgInp" />
<img id="blah" src="#" alt="your image" />
</form>
'IT > jquery' 카테고리의 다른 글
table 안의 체크된 체크박스 Row 값 알아내기 (0) | 2016.12.15 |
---|---|
table 안의 라디오버튼 하나씩 체크 (0) | 2016.12.15 |
콤보박스 텍스트 값 (0) | 2015.11.20 |
div 태그에 html 태그 적용 (0) | 2015.04.29 |
동적 html 컨트롤 찾기 (0) | 2015.03.04 |