JSFiddle - React, Tailwind, and code Playground
HTML
<input type="password" class="password" value="" />
<button class="lihat-pass show-password">Lihat Password</button>
JavaScript
$(document).ready(function(){
$('.lihat-pass').on('click',function(){
var box = $(this);
if(box.hasClass('show-password')){
$('.password').attr('type','text');
box.addClass('hiding-password').removeClass('show-password');
box.text('Sembunyikan Password');
}else if(box.hasClass('hiding-password')){
$('.password').attr('type','password');
box.addClass('show-password').removeClass('hiding-password');
box.text('Lihat Password');
}else{
//
}
});
});