I have an html page in which there is a table and i want to export the table data to Excel file.
I used the following code:
<head>
<title>Email application</title>
<script src="Scripts/jquery-2.1.1.js"></script>
<script src="Scripts/jquery-2.1.1.min.js"></script>
<script type="text/javascript">
$("#BtnSendMessage").click(function(e) {
window.open('data:application/vnd.ms-excel,' + encodeURIComponent($('#TblExport').html()));
e.preventDefault();
}) </script></head>
My Html Page:
<body>
<table id="TblExport">
<tr>
<td><input type="text" id="TxtName" /></td>
<td><input type="text" id="TxtEmail" /></td>
</tr>
<tr>
<td colspan="2">
<textarea id="TxtMessage"></textarea>
</td>
</tr>
<tr>
<td><input type="button" id="BtnSendMessage" value="SendMessage" /></td>
<td><label id="LblErrorMessage"></label></td>
</tr>
</table>
Now, after clicking on the button nothing is happening..