728x90
๋ฐ์ํ
<label for="attached">
<input class="file_real" id="attached" type="file"> //์ค์ ํ์ผ ์ฒจ๋ถ ๊ธฐ๋ฅ
<input class="file_fake" type="text" placeholder="* 10MB ๋ฏธ๋ง์ jpg, png, bmp, gif๋ง ์ฒจ๋ถ ๊ฐ๋ฅ" readonly tabindex="-1"> //์ฌ์ฉ์์๊ฒ ๋ณด์ฌ์ง๋
<span class="btn">์ฒจ๋ถํ๊ธฐ</span>
</label>
label { position: relative; display: block; height: 60px; cursor: pointer; }
.file_real { position: absolute; top: 0; left: 0; z-index: -1; opacity: 0; width: 0; height: 0; }
.file_fake { position: absolute; top: 0; left: 0; z-index: 2; padding: 0 calc(134px + 37px) 0 37px; width: 100%; height: 100%; font-size: 16px; border: 2px solid #111; border-radius: 30px; pointer-events: none; user-select: none; touch-action: none; }
$('.file_real').on('change', function() {
var files = $(this)[0].files[0];
var fake = $('.file_fake');
fake.val('');
if ( files !== undefined ) {
fake.val(files.name);
}
});
https://jsfiddle.net/aw71qf0b/
๋ฐ์ํ
'js' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
textarea ๊ธ์์ ์นด์ดํธ ๊ธฐ๋ฅ ๋ฐ ์ ํ (0) | 2022.03.05 |
---|---|
tooltip ํดํ ๋ฌด๋ฃ ๋ผ์ด๋ธ๋ฌ๋ฆฌ (0) | 2022.02.06 |
jQuery Migrate Plugin - Warning Messages (0) | 2021.01.25 |
[swiper.js] slide effect fade, display:none=>block (2) | 2020.12.29 |
jquery ํจ์จ์ ์ผ๋ก ์์ฑํ๋ ๋ฐฉ๋ฒ (0) | 2019.12.12 |