Dropdown <option> reset after print command

Viewed 45

I have made it so the user can print a div by pressing an image (in this example a text). In this div I have two dropdowns. I also have a few input fields which I made by the user having to type into a div.

When the user prints, the text inside the input fields stays. However, the dropdown gets reset to its first position, no matter what I select.

How can I make it so that the page does not reset the dropdown and displays it on the printed document?

    function printdiv(printpage)
{
var headstr = "<html><head><title></title></head><body>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var oldstr = document.body.innerHTML;
document.body.innerHTML = headstr+newstr+footstr;
window.print();
document.body.innerHTML = oldstr;
return false;
} 
 <div id="div_print">
 <select>
<option>Choice 1</option>
<option>Choice 2</option>
<option>Choice 3</option>
</select>
 <div style="border-style: solid;" contentEditable="true"></div>
<a name="b_print" type="button" class="ipt"   onClick="printdiv('div_print');" value=" Print ">
 Click me to print!  
    </a>
</div>

0 Answers
Related