All Projects → terrylinooo → Disableautofill.js

terrylinooo / Disableautofill.js

Licence: mit
Disable form auto-fill and auto-complete functions.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Disableautofill.js

Ajax Live Search
AJAX Live Search is a PHP search form that similar to Google Autocomplete feature displays the result as you type.
Stars: ✭ 238 (+18.41%)
Mutual labels:  jquery-plugin, auto-complete
Calx.js
jQuery Calx - a jQuery plugin for creating formula-based calculation form
Stars: ✭ 190 (-5.47%)
Mutual labels:  jquery-plugin
Jquery Ui Contextmenu
jQuery plugin that turns a jQueryUI menu widget into a context menu.
Stars: ✭ 170 (-15.42%)
Mutual labels:  jquery-plugin
Jquery History
Super-seeded by https://github.com/browserstate/history.js
Stars: ✭ 183 (-8.96%)
Mutual labels:  jquery-plugin
Bdialog
Extend the Bootstrap Modal features, making dialog more functions and easier to use, dialog type including modal, alert, mask and toast types
Stars: ✭ 174 (-13.43%)
Mutual labels:  jquery-plugin
Restable
jQuery plugin that makes tables responsive converting them to HTML lists on small viewports.
Stars: ✭ 183 (-8.96%)
Mutual labels:  jquery-plugin
Stickyfloat
This plugin makes it possible to have a fixed position element that is relative to it’s parent. A normal fixed positioned element would be “out of context” and is very difficult to use in the most common situations with fluid designs. This plugin solves that problem with as little code as I could possible get it so it will run in the most optimized way, while also allow you to customize it in many important ways which might suit you best.
Stars: ✭ 166 (-17.41%)
Mutual labels:  jquery-plugin
Jquery Indexeddb
An IndexedDB Plugin for Jquery.
Stars: ✭ 197 (-1.99%)
Mutual labels:  jquery-plugin
Failsafe.js
A jQuery Plugin to make your App Robust
Stars: ✭ 190 (-5.47%)
Mutual labels:  jquery-plugin
Jquery Contextmenu
jQuery contextMenu plugin & polyfill
Stars: ✭ 2,148 (+968.66%)
Mutual labels:  jquery-plugin
Jquery.redirect
jQuery Redirect Plugin
Stars: ✭ 182 (-9.45%)
Mutual labels:  jquery-plugin
Ui Components
Most used UI Components — of web applications. Curated/Most loved components for web development
Stars: ✭ 175 (-12.94%)
Mutual labels:  jquery-plugin
Rangeslider.js
🎚 HTML5 input range slider element polyfill
Stars: ✭ 2,153 (+971.14%)
Mutual labels:  jquery-plugin
Formbuilder
A jQuery plugin for drag and drop form creation
Stars: ✭ 2,194 (+991.54%)
Mutual labels:  jquery-plugin
Jquery Gantt
🌈 Lightweight jQuery gantt plugin.
Stars: ✭ 193 (-3.98%)
Mutual labels:  jquery-plugin
Sticky Sidebar
😎 Pure JavaScript tool for making smart and high performance sticky sidebar.
Stars: ✭ 2,057 (+923.38%)
Mutual labels:  jquery-plugin
Lulu
LuLu UI for PC web
Stars: ✭ 2,354 (+1071.14%)
Mutual labels:  jquery-plugin
Bs grid
Bootstrap Datagrid
Stars: ✭ 184 (-8.46%)
Mutual labels:  jquery-plugin
Hc Offcanvas Nav
JavaScript library for creating toggled off-canvas multi-level navigations, allowing endless nesting of submenu elements, supporting swipe gestures, keyboard interactions and ARIA attributes.
Stars: ✭ 201 (+0%)
Mutual labels:  jquery-plugin
Croppie
A Javascript Image Cropper
Stars: ✭ 2,330 (+1059.2%)
Mutual labels:  jquery-plugin

disableautofill.js

Disable auto-fill, auto-complete functions

The easiest solution for disabling Google Chrome auto-fill, auto-complete functions.

This library does the following steps:

  • Replace type="password" with type="text". [1]
  • Replace the text of password with asterisk symbols.
  • Add an attribute autocomplete="off" on form.
  • Randomize the attribute name in order to prevent Google Chrome to remember what you filled.

Note:

[1] It is recommended to use type="text" directly, or it might not work depends on browser's version and page rendering speed.

Install

NPM

npm install disableautofill

Bower

bower install terrylinooo/disableautofill.js

CDN

# Pure JS, without jQuery
https://cdn.jsdelivr.net/npm/[email protected]/dist/disableautofill.min.js

# jQuery plugin.
https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.disableautofill.min.js

Usage

HTML

<form id="login-form">
    ...
</form>

JS

var daf = new disableautofill({
    'form': '#login-form',
    // settings...
});

daf.init();

Or, if you like to use jQuery plugin.

$('#login-form').disableAutoFill({
    // settings...
});

Options

option default type note
form null string The id or class of the form. For example: #my-form, .custom-form. This option is ignored if using jQuery plugin..
fields [] array The id or class of the fields (the input elements for filling password in the form). For example: ['.newpass', 'newpass2']
asterisk string Character use to hide the real password value.
debug false bool Print colorful message in browser's development console.
callback null function To validate form fields or something you can do.

Examples

This example form presents the main functionality of disableautofill.js A HTML form and a JavaScript function that is a form validator.

<form id="testForm" method="get" action="/">
    <div class="input-group">
        <label>Username</label>
        <input type="text" name="username">
    </div>
    <div class="input-group">
        <label>Password</label>
        <input type="text" name="password" class="test-pass">
    </div>
    <div class="input-group">
        <label>Confirm password</label>
        <input type="text" name="confirm_password" class="test-pass2">
    </div>
    <div class="button-section">
        <button type="submit">Submit</button>
    </div>
</form>
<script>

/**
 * Callback function is usually a form validator.
 *
 * @return bool
 */
function checkForm() {
    form = document.getElementById('login-form');
    if (form.password.value == '' || form.confirm_password.value == '') {
        alert('Cannot leave Password field blank.');
        form.password.focus();
        return false;
    }
    if (form.username.value == '') {
        alert('Cannot leave User Id field blank.');
        form.username.focus();
        return false;
    }
    return true;
}
</script>

JS

 var daf = new disableautofill({
    'form': '#testForm',
    'fields': [
        '.test-pass',  // password
        '.test-pass2'  // confirm password
    ],
    'debug': true,
    'callback': function() {
        return checkForm();
    }
});

daf.init();

jQuery

$('#test-form').disableAutoFill({
    'fields': [
        '.test-pass', // password
        '.test-pass2' // confirm password
    ],
    'debug': true
    'callback': function() {
        return checkForm();
    }
});

Development

If you would like to contribute code to this project.

# Clone project.
git clone [email protected]:terrylinooo/jquery.disableAutoFill.git your-branch-name

# Get into the `your-branch-name` directory, run:
npm install

# Run a develpment web server, listen to port: `8000`
npm run start

Test pages

http://127.0.0.1:8000

# This page is for jQuery plugin.
http://127.0.0.1:8000/jquery

A test page will be showed and you can modify the code and see the results in real time.

The Debugging messages will be showed in the development console.

License

MIT

Authors

disableautofill.js is brought to you by Terry Lin from Taiwan.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].