'Not able the hide content in of HTML page and show it at the time of print

Hi I try to hide one of the chart from main page and want to show it at the time of print.But it is not working for me.

HTML:

<div class="bar-chart">
  <div class="canvas-holder3"><canvas id="resultsChart7"></canvas></div>
</div>

CSS:

.bar-chart {
  display: none;
}

@media print {
  body,
  html,
  #wrapper {
    width: 100%;
  }

  .bar-chart {
    display: block;
    visibility: visible;
  }
}


Solution 1:[1]

you need to add javascript for that.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Tanjeeb Ahsan