My Code:
$('.classname').on ("click" ,function() {
var newpage = "Html Elements for blank page";
var mywindows = window.open("","_blank","");
mywindows.document.open() ;
mywindows.document(newpage);
mywindows.document.close() ;
});
<button class="classname">Click here</button>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
I want to make it short By Using:
$('html').html('my html elements');
but I can't success to use this, It Always shows result in the current page, and opens a blank page, and I don't have any idea to fix it! Here is the code:
$('.classname').on ("click" ,function() {
var newpage = window.open('','_blank','');
newpage.$('html').html('my html elements are here');
});