mickeymouse Posted December 15, 2019 Share Posted December 15, 2019 How do we prevent Buttons from printing when printing a page? I thought it should something like putting class='noprint' in the button code but that doesn't work. Tks Link to comment Share on other sites More sharing options...
Ingolme Posted December 15, 2019 Share Posted December 15, 2019 You can add some CSS to hide the element when printing using a media query: https://www.w3schools.com/cssref/tryit.asp?filename=trycss3_media Link to comment Share on other sites More sharing options...
mickeymouse Posted December 18, 2019 Author Share Posted December 18, 2019 The link you gave me is not at all clear. It only gives an example instead of explaining/teaching. However, I came up with the following and it works: <style> @media print {.noprint {display: none !important;}} </style> <input type=\"button\" value='Print' class='noprint' onclick='myprint()'> function myprint() {window.print();} Thanks for your help. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now