I am looking for a solution to print just a specific div from a website with dimensions of 3"x5". Despite setting up the print button, the entire page continues to print every time.
Is there a way to hide all non-div content in print preview?
CSS
.wholebody {
height: 289px;
width: 489px;
border: 2px solid #00001a;
}
</style>
HTML
<body>
<button onclick="window.print()">Print Page</button>
<div class="wholebody">
</div>
Please advise on any necessary JS functions needed to achieve hiding non-div content. Thank you.