Show and hide input with one click
Easy code Vanilla & Pure Javascript
npm i hidenger
OR
npm install hidenger
- Input only works with ID attribute
- The button must have a "data-relevant-input" attribute and this value must match the input's ID
<div>
<input type="password" id="user-password">
<button type="button" id="user-password-manipulation" data-relevant-input="user-password">Show Password</button>
</div>
<div>
<input type="password" id="user-password2">
<button type="button" class="user-password-manipulation2" data-relevant-input="user-password2">Show Password</button>
</div>
Hidenger.trigger('#user-password-manipulation');
Hidenger.trigger('.user-password-manipulation2');
@selimdoyranli