Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

printing div that is originally set to display:none;

Tags:

jquery

css

I have a div that is viewable if you click the appropriate link, using jQuery's slideToggle to display it.

It has

$(document).ready(function() {
    $('#content-click').click(function() {
        $("#content").slideToggle(100);
    });
});

<div id="content" style="display:none;">
    this is the content
</div>

In the print css, I thought maybe setting #content to #content { display: block; } would do the trick, but no luck.

Any help is appreciated.

like image 230
Brad Avatar asked Jan 23 '26 00:01

Brad


1 Answers

You need to move the display:none declaration from being inline to being in your regular stylesheet. The reason your print stylesheet is not showing the div when printing is that its being overriden by the inline style.

like image 87
Darko Z Avatar answered Jan 24 '26 16:01

Darko Z



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!