JSFiddle - React, Tailwind, and code Playground

by mamounothman

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.0/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.13.0/css/all.min.css">
<div class="pwdMask">
    <input type="password" class="form-control" name="_password" placeholder="(...)" />
    <span class="focus-input"></span>
    <span class="fas pwd-toggle fa-eye-slash"></span>
</div>

JavaScript

var e = $(".pwdMask > .form-control"),
    t = $(".pwd-toggle");
    
$(t).on("click", function (t) {
	t.preventDefault(),
		$(this).toggleClass("fa-eye fa-eye-slash"),
		$(this).hasClass("fa-eye") ? $(e).attr("type", "text") : $(e).attr("type", "password")
  });