Reputation: 634
I have a export to excel link on my page like:
<a download="queryResults.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV</a>
I would like to present it as a button, I tried something like:
<button download="queryResults.csv" href="#" onclick="return ExcellentExport.csv(this, 'datatable');">Export to CSV</button>
Hoe should I get it to work? Thanks.
Upvotes: 0
Views: 266
Reputation: 12391
<a download="queryResults.csv"
onclick="return ExcellentExport.csv(this, 'datatable');" href="#">
<button>Export to CSV</button>
</a>
Upvotes: 2
Reputation: 21
The button element has no href
attribute. Instead you have to provide a type
attribute, which has to be type="button"
. See the specs here: HTML button tag
Upvotes: 0