mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 22:03:49 -07:00
feat: Add clear button for file upload input in posting_attach.tpl
(#2072)
This commit is contained in:
parent
eecfe1a951
commit
7c6ab0eed4
1 changed files with 21 additions and 0 deletions
|
@ -1,6 +1,8 @@
|
||||||
<!-- IF TPL_ADD_ATTACHMENT -->
|
<!-- IF TPL_ADD_ATTACHMENT -->
|
||||||
<!--========================================================================-->
|
<!--========================================================================-->
|
||||||
|
|
||||||
|
<style>#clear_file_upload { display: none; }</style>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2" class="thHead">{L_ADD_ATTACHMENT_TITLE}</th>
|
<th colspan="2" class="thHead">{L_ADD_ATTACHMENT_TITLE}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -10,6 +12,7 @@
|
||||||
<table class="borderless" cellspacing="0">
|
<table class="borderless" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="pad_4">
|
<td class="pad_4">
|
||||||
|
<input type="button" id="clear_file_upload" value="{L_CLEAR}" />
|
||||||
<input type="file" name="fileupload" size="45" maxlength="{FILESIZE}" />
|
<input type="file" name="fileupload" size="45" maxlength="{FILESIZE}" />
|
||||||
<p class="small nowrap">{L_ADD_ATTACHMENT_EXPLAIN}</p>
|
<p class="small nowrap">{L_ADD_ATTACHMENT_EXPLAIN}</p>
|
||||||
</td>
|
</td>
|
||||||
|
@ -26,6 +29,24 @@
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$('input[name="fileupload"]').on('change', function () {
|
||||||
|
if (this.files && this.files.length > 0) {
|
||||||
|
$('input[type=button]#clear_file_upload').show();
|
||||||
|
} else {
|
||||||
|
$('input[type=button]#clear_file_upload').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('input[type=button]#clear_file_upload').on('click', function () {
|
||||||
|
$('input[name="filecomment"]').val('');
|
||||||
|
$('input[name="fileupload"]').val('');
|
||||||
|
$('input[type=button]#clear_file_upload').hide();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<!--========================================================================-->
|
<!--========================================================================-->
|
||||||
<!-- ENDIF / TPL_ADD_ATTACHMENT -->
|
<!-- ENDIF / TPL_ADD_ATTACHMENT -->
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue