Dear friends,
I am trying to print the divs content with the help of jquery.
But its not printing the latest changes done to the HTML elements its only printing the values and html elements those are initially returned by server side php via ajax and jason.
In other words I am dynamically populating the reservediv at first, then I apply other jquery script to update those dynamically created html elements values and I can see my results on screen, but when I call the print function to take a print its printing only the old values inititally returned by the server not the new values on the screen
I would appreciate the help.
Many thanks in advance.
the code is as follows.
<div id="reservediv" class="divmargin" style="display: none;">
<input type="submit" value="Update" id="reserveupdate" style="display: none;" />
<input type="button" value="Print" onclick="PrintElem('#reservediv')" class="btnprnt" />
<input type="button" value="Save" class="btnprnt" id="savereserve"/>
<div id="resultsaving" > </div>
<div id="reserveaccountbtn"style="display: none;">
<input type="submit" value="RESERVE-XXXXXX8751" class="bankmovementsbtn" id="btnreserve" style="display: none;">
<input type="text" value="" id="reserveaccounttext" class="bankmovementsbtn"style="display: none;">
<div id="openingbaldiv" class="divopening">
<input type ="button" value="Beginning Balance" class="reconfields" id="openingbalbutton"/>
<input type="text" value="0" class="reconfields" id="openingbaltext" >
</div>
<div id="reconcilediv" class="divreconcile">
<input type ="button" value="Ending Balance" class="reconfields" id="closingbalbutton"/>
<input type="text" value="" id="closingbaltext" class="reconfields">
</div>
<div id="clearedbaldiv" class="divclearedbal">
<input type ="button" value="Cleared Balance" class="reconfields" id="clearedbalbutton"/>
<input type="text" value="" id="clearedbaltext" class="reconfields" >
</div>
<div id="differencebaldiv" class="divdifferencebal">
<input type ="button" value="Difference" class="reconfields" id="differencebalbutton"/>
<input type="text" value="" id="differencebaltext" class="reconfields">
</div>
<input type ="button" value="Check All" id ="selectchbx" class = "update" />
<input type ="button" value="Uncheck All" id ="selectunchbx" class = "update" />
<input type ="button" value="Calculate" id ="reconcilereserve" class = "update" />
Code to make print via jquery
<script type="text/javascript">
<!--
function PrintElem(elem)
{
Popup($(elem).html());
}
function Popup(data)
{
var mywindow = window.open('','Print Area','height=900 width=950');
mywindow.document.write('<input type="text" id="messageprint1" value=" For Firefox browser Press ctr+p to Print then close the Popup window, For Google Chrome just Press ctr+p to print" />');
mywindow.document.write('<html><head><link REL="STYLESHEET" TYPE="text/css" HREF="printout.css" media="print"> <link REL="STYLESHEET" TYPE="text/css" HREF="generatereports.css" media="screen"> <title>Print Area</title>');
mywindow.document.write('</head><body >');
mywindow.document.write(data);
mywindow.document.write('</body></html>');
return true;
}
</script>