Here is the exmaple for opening your HTML in a new tab with jQuery, first we define a function for the window in which we take variables for the tab (w) and for HTML (html) that will be opened in a new tab.
Then we define a click event from which it will open a tab.
<script>
function nWin() {
var w = window.open();
var html = $("#toNewWindow").html();
$(w.document.body).html(html);
}
$(function() {
$("a#print").click(nWin);
});
</script>
<div id="toNewWindow">
<p>Your content here</p>
</div>
<a href="javascript:;" id="print">Open</a>
0 Comment(s)