For the button you can do
<form method="get" action="file.doc">
<button type="submit">Download!</button>
</form>
How to trigger a file download when clicking an HTML button or JavaScript
This is crazy but I don't know how to do this, and because of how common the words are, it's hard to find what I need on search engines. I'm thinking this should be an easy one to answer.
I want a simple file download, that would do the same as this:
<a href="file.doc">Download!</a>
But I want to use an HTML button, e.g. either of these:
<input type="button" value="Download!">
<button>Download!</button>
Likewise, is it possible to trigger a simple download via JavaScript?
$("#fileRequest").click(function(){ /* code to download? */ });
I'm definitely not looking for a way to create an anchor that looks like a button, use any back-end scripts, or mess with server headers or mime types.
=========================================================================
ANSWER
For the button you can do
<form method="get" action="file.doc">
<button type="submit">Download!</button>
</form>
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 4 | [Bootstrap3] Bootstrap 기본 | 졸리운_곰 | 2020.02.20 | 506 |
| 3 |
bootstrap 시작하기
| 졸리운_곰 | 2017.01.29 | 718 |
| 2 |
Bootstrap 사용법
| 졸리운_곰 | 2017.01.29 | 716 |
| 1 |
Bootstrap
| 졸리운_곰 | 2017.01.29 | 365 |