mardi 1 février 2022

How to reload page after using window.print function?

I have a few checkboxes that are printing using window.print but after using window.print function, i have a blank space under the checkboxes, which is created by the div that is printed. In this case, i would like to reload the page after the user will close the window.print dialog box. In order to print only the selected checkboxes, i am using a jQuery plugin called printThis and my code looks like this >

$("#print").on("click", function() {
  var array = [];
  $("input:checkbox[name=type]:checked").each(function() {
    array.push($(this).val());
  });
  $("#results_after").html(array.join('<br /> <br />')).show();
  $('#results_after').printThis({
    importCSS: true,
    loadCSS: "",
    header: "<h1>Your results are:</h1>"
});
});

Can you please help me in order to get rid of that space which is creating after printing? Thanks in advance!

I mention that i am a junior :)




Aucun commentaire:

Enregistrer un commentaire