1// Use title attribute to show text on hover
2<button type="button" id="eye" title="Show Password" class="btn btn-light" onclick="show()"> <i class="fa fa-eye"></i> </button>
3
4<script>
5 function show() {
6 var y = document.getElementById("eye");
7 if (x.title === "Show Password") {
8 y.title = "Hide Password";
9 } else {
10 y.title = "Show Password";
11 }
12 }
13</script>