Skip to content

How can I hide and show password text #5255

Closed Answered by asyncLiz
Staler2019 asked this question in Q&A
Discussion options

You must be logged in to vote

Add a click listener to the icon button and swap the text field's type with password or text

https://lit.dev/playground/#gist=f64f6ee859231ab1e0c955b5a9153afc

iconbutton.addEventListener('click', () => {
  textfield.type = iconbutton.selected ? 'text' : 'password';
});

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Staler2019
Comment options

@alexmeier-19
Comment options

@asyncLiz
Comment options

Answer selected by Staler2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants