How to print selected div instead complete page

后端 未结 10 1847
滥情空心
滥情空心 2020-12-13 07:43

I have two divs: div1 and div2.

Maintaining the original css styles applied to the div2 element being printed.

I don\'

10条回答
  •  北海茫月
    2020-12-13 08:12

    .class-toggle { display: inline-block; }
    #div1, #div2 { display: none; }
    
    function classToggle() {
      $('#div1').addClass('class-toggle');
    }
    
    classToggle();
    

    Then you can play with event handler to handle how and when you want to print the output.

提交回复
热议问题