Polish upload call to action
This commit is contained in:
+12
-5
@@ -22,16 +22,23 @@
|
||||
<form class="upload-panel" method="post" action="/r/{{slug}}" enctype="multipart/form-data">
|
||||
<p class="upload-panel__today">오늘의 순간</p>
|
||||
|
||||
<label class="file-picker">
|
||||
<span class="file-picker__label">사진 선택</span>
|
||||
<label class="upload-button file-picker" aria-label="업로드">
|
||||
<span>사진 올리기</span>
|
||||
<input type="file" name="files" accept="{{accept}}" multiple required>
|
||||
</label>
|
||||
|
||||
<button class="upload-button" type="submit" aria-label="업로드">
|
||||
<span>사진 올리기</span>
|
||||
</button>
|
||||
<button class="submit-fallback" type="submit" aria-label="업로드">사진 올리기</button>
|
||||
</form>
|
||||
</section>
|
||||
</main>
|
||||
<script>
|
||||
document.querySelectorAll(".upload-panel").forEach((form) => {
|
||||
const input = form.querySelector('input[type="file"][name="files"]');
|
||||
const submit = form.querySelector('button[type="submit"]');
|
||||
input?.addEventListener("change", () => {
|
||||
if (input.files && input.files.length > 0) submit?.click();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user