I want to print my table data onclick
.
I use the following JavaScript code:
<input type="button" name="print" id="print" value="Print" onclick="myFunction()"/>
<script>
myFunction()
{
window.print();
}
</script>
But the code prints the entire web page.
I want to print only my table like printing a receipt how to do it?