0
Greetings Clicking on the Button in my project shows the following Typeerror: $(...). tableToJSON is not a Function, I am using the tableToJSON plugin
Code:
$('document').ready(function(){
$('#TermVenda').click(function(){
var table =$('#products-table').tableToJSON();
console.log(table);
document.write(JSON.stringify(table));
alert(JSON.stringify(table));
});
});
HTML table: <!DOCTYPE html>
<html>
<head>
<title>Pagina do Cliente</title>
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js/jquery.tabletojson.min.js"></script>
</head>
<body>
<table id="products-table" class="table table-hover table-bordered"> <thead>
<tr>
<th>Produto</th>
<th>Preço </th>
<th>Qtd</th>
<th>Valor</th>
<th>Ações</th>
</tr>
</thead>
<tbody>
<tr>
<td>Banana</td>
<td>20</td>
<td>5</td>
<td>100</td>
<td>x</td>
</tr>
<tr>
<td>Alho</td>
<td>20</td>
<td>5</td>
<td>100</td>
<td>x</td>
</tr>
</tbody>
</table>
<button id="TermVenda">Converter</button>
</body>
</html>
You have built jquery.tabletojson.js into your page ?
– Rafael Salomão
Yes they are all included there
– Setimo Muteca Jr.
You may have included jquery.tablejson.js before including jquery.js. Change the question and post html with the js included as well.
– Rafael Salomão