How it works…

In this recipe, we have a simple form, with two input fields (an email address field and a password input field) and a submit button. The password input field has an input add-on button on its right side, with the button styled using the contextual btn-danger class. Inside the button, we see an icon of a closed padlock.

The idea is pretty simple, we want to allow the user to click on the input add-on button, on the right edge of the password input field. This click will change the visibility of characters in the password input field. The obscured password characters are made visible via a simple change of the type attribute from password to text. At the same time, the input add-on button changes its contextual color from danger ...

Get Bootstrap 4 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.