JSFiddle - React, Tailwind, and code Playground
HTML
<form id="form" action="">
Name: <input type="text" id="name" name="user"><br>
Password: <input type="password" name="password"><br>
<button type="button" id="button">Useless Button</button>
</form>
JavaScript
$('#button').on('click',function() {
var popup = window.open("","mypopup","width=500,height=300");
var html = $("#input").html();
$(popup.document.body).html(html);
popup.print();
//alert(html);
});