JSFiddle - React, Tailwind, and code Playground

by nucklear

HTML

<form>
    <input type="password" name="foo" />
    <input type="password" name="var" />
    <input id="toggleBtnChbox" type="checkbox" name="checkbox"/>    
</form>

JavaScript

$('#toggleBtnChbox').click(function(){
       
    if($(this).is(':checked')){
        $('form input[type="password"]').prop('type','text');
    }
    else {
        $('form input[type="text"]').prop('type','password');
    }          
    
    });