Answers for "how to toggle hover display text of button on click"

1

how to toggle hover display text of button on click

// Use title attribute to show text on hover
<button type="button" id="eye" title="Show Password" class="btn btn-light" onclick="show()"> <i class="fa fa-eye"></i> </button>

<script>
    function show() {
        var y = document.getElementById("eye");
        if (x.title === "Show Password") {
            y.title = "Hide Password";
        } else {
            y.title = "Show Password";
        }
    }
</script>
Posted by: Guest on June-08-2021

Code answers related to "how to toggle hover display text of button on click"

Browse Popular Code Answers by Language