# Print using Menu Button

The print link by default in Knack is currently set to the right side as a link. For new users, they might not be familiar with where to print the page so having it as a menu button would assist in visibility.

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FdEsnTTmd37v2dSGOPSx9%2Fimage.png?alt=media&#x26;token=64e5e82c-b256-479c-a6d0-d917756af4c8" alt=""><figcaption></figcaption></figure>

Below is an example of what this code will do to a static menu view:

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FdaMPTj0dhNi7GZpmcMYP%2F2B251753-E1BC-4DF3-B5FC-C71A6E79AC9F.GIF?alt=media&#x26;token=da17dd3b-33bc-4bbc-893d-dd7cb1a68419" alt=""><figcaption></figcaption></figure>

## The JS

Add the following code and modify line 12 to the view number.

{% code lineNumbers="true" %}
```javascript
/***************************************/
/***** Print Menu Button ************/
/***************************************/
function printMenuButton(view_id) {
  $(document).on('knack-view-render.' + view_id, function(event, view, data) {
      $('#' + view_id + ' .knMenuLink').click(function(e) {
        window.print();
      });
  });
}

printMenuButton('view_XXX'); // Set the menu view number
```
{% endcode %}

Keep in mind that whatever view you set will apply the `window.print()` action on click, **so keep the print menu button the only button in the menu view.**

## The CSS

None currently since Menu views on Knack are automatically hidden in print preview.

## How to Implement

Add View > Static Menu > Link to a URL

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FJ2LvBG2hCNO1Xl3nq042%2Fimage.png?alt=media&#x26;token=01617f20-3ee5-40f9-a486-51c2f3fdde1a" alt=""><figcaption></figcaption></figure>

Set URL to `javascript:void(0);`

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FtLTVHrhi169uKRimcPBS%2Fimage.png?alt=media&#x26;token=b1f21d5d-3137-4a08-afa3-06a844c43ce2" alt=""><figcaption></figcaption></figure>

Remember the view number (from the URL) and modify the JS code to that view number.

<figure><img src="https://3087753818-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LzNSSXajDFpzOv2IhIv%2Fuploads%2FvLGPiKU04ucDcwjl4yr5%2Fimage.png?alt=media&#x26;token=9569807a-e19a-4b0f-8bc0-bc0ca517a906" alt=""><figcaption></figcaption></figure>
