Git Product home page Git Product logo

bootstrap5-togglepassword's Introduction

bootstrap5-togglepassword

Toggle Password v1.0.0

Description: Toggle password visibility by simply adding $('[type="password"]).togglepassword(); to your javascript

Works with the following dependencies:

How to use:

  1. Add Bootstrap CSS and Bootstrap Icons CSS files to your tag
  2. Add jQuery JS file to your tag, preferable at the end of the body
  3. Add the bootstrap5-togglepassword JS file after the jQuery script
  4. Include the line on your Document Load event: $('[type="password"]).togglepassword();

Sample code:

<!doctype html>

<title>Sample</title>
<main>
    <div class="bg-body-secondary d-flex align-items-center justify-content-center vh-100 p-3">
        <div class="card w-100" style="max-width: 20rem;">
            <div class="card-body">
                <form data-role="form" data-action="action/login" autocomplete="off">
                    <fieldset>
                        <div class="mb-3">
                            <label class="form-label" for="username">Username</label>
                            <input type="text" class="form-control" id="username" name="username" required autofocus>
                        </div>
                        <div class="mb-3">
                            <label class="form-label" for="password">Password</label>
                            <input type="password" class="form-control" id="password" name="password" required>
                        </div>
                        <button class="btn btn-primary w-100">Login</button>
                    </fieldset>
                </form>
            </div>
        </div>
    </div>

</main>

<script src="assets/js/bootstrap.bundle.min.js"></script>
<script src="assets/js/jquery-3.7.1.min.js"></script>
<script src="assets/js/togglepassword.js"></script>
<script>
    $(() => {

        $('[type="password"]').togglepassword('btn');

    });
</script>

bootstrap5-togglepassword's People

Contributors

rienerdparinas avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.