JSFiddle - React, Tailwind, and code Playground

HTML

<input type="password" id="new_pass" value="" placeholder="New" />
<label class="pw_show">
    <input type="checkbox" />Show Password</label>

JavaScript

var pwi = $('#new_pass');

$('.pw_show').find("input[type=checkbox]").mousedown('change', function () {
    pwi.prop("type",  "text" );

});
$('.pw_show').find("input[type=checkbox]").mouseup('change', function () {
      
    pwi.prop("type",  "password");

});