Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
$("#togglePass").on("click", function() { const input = $("#password"); const isText = input.attr("type") === "text"; input.attr("type", isText ? "password" : "text"); $(this).html(isText ? "Show" : "Hide"); });
Result
Open