上傳圖片時button按鈕隱藏,用做好的樣式
阿新 • • 發佈:2019-02-11
jsp:<div class="input-box">
<span>主題首頁</span>
<div class="img-box">
<img class="img-icon" src="${ctx}/${subject.picUrl}" id="imgs"
alt="" style="width: 100%; height: 100%; top: 0;" /> <input
name="filepathsave" id="filepathsave" type="hidden"
value="${subject.picUrl}" />
</div>
<p class="check-img">
<input type="file" id="files" onchange="onChangeUploadImage(this)"
multiple="multiple" style="opacity: 1" type="hidden">
<button onclick="clickFileInput()">選擇圖片</button>
(本格式支援jpg、png等格式)
</p>
<span>主題首頁</span>
<div class="img-box">
<img class="img-icon" src="${ctx}/${subject.picUrl}" id="imgs"
alt="" style="width: 100%; height: 100%; top: 0;" /> <input
name="filepathsave" id="filepathsave" type="hidden"
value="${subject.picUrl}" />
</div>
<p class="check-img">
<input type="file" id="files" onchange="onChangeUploadImage(this)"
multiple="multiple" style="opacity: 1" type="hidden">
<button onclick="clickFileInput()">選擇圖片</button>
(本格式支援jpg、png等格式)
</p>
</div>
js: $('#files').hide();//讓按鈕隱藏
function clickFileInput(){
$("#files").click();
}
//點選按鈕時觸發選擇圖片事件