Show/Hide Password...how do you do it?

Right now, I'm using two inputs, one that is type="password" and the other type="text" and showing or hiding based on a variable that is set. The hidden input is disabled so it isn't submitted. I thought maybe I could simplify this using one input and binding the type like so...

dmx-bind:type="!varShowPassword.value?'password':'text'"

...but this doesn't seem to work. The two input method works fine, but gets a little awkward when setting the validation and having to check which field is being submitted.

Thanks,
Twitch

This guy made an amazing tutorial: Show/Hide Password on Registration

1 Like

Hmmm...he's using dmx-bind:type like I was trying to do but binding the type didn't work for me. Let me look into that some more since it appears to be possible.

Well after some cleaning up of the code:

dmx-bind:type="!varShowPassword.value?'password':'text'"

Works now. I was overthinking it as usual haha.