Code Monkey home page Code Monkey logo

Comments (5)

barrychapman avatar barrychapman commented on September 27, 2024

It's not much use outside the form, no?

from disableautofill.js.

matronator avatar matronator commented on September 27, 2024

How so? If you specify the form attribute, you can still submit the form as you would normally do.

from disableautofill.js.

barrychapman avatar barrychapman commented on September 27, 2024

Oh nevermind I see. I missed that part.

It should be fairly straightforward to select all the inputs with that form attribute

from disableautofill.js.

barrychapman avatar barrychapman commented on September 27, 2024

The caveat is, that you would need to do a full DOM scan for any elements that were directed to that form. When applying it to the form, you are looking at all the children, while if you take into consideration the elements occurring outside the form... Well, you would basically need to do this:

 jQuery(document.body).on('click', 'input[type="submit"]', function(e) {
      // first check to see if the click input has a form attribute
      var formId = jQuery(this).attr('form');
      if (formId.length) {
           e.preventDefault();   // prevent form from submitting prior to performing operations
           // then you will want to grab that attribute, and target the form in question:
           jQuery('#' + formId).disableAutoFill() // or whatever. You may even need a custom function inside the library itself to forcibly perform the replacements against the form instead of listening for a click.
           this.submit();  // submit form once all processes are complete? maybe as a callback even to the `disableAutoFill()`
      }
});

Something like that may be the best bet.

TL;DR - you will basically need to listen on all nodes that have the form="whatever" attribute in order to intercept appropriately. There are messy ways and messier ways to do this, and some not-so-messy.

from disableautofill.js.

shaangidwani avatar shaangidwani commented on September 27, 2024

Can we apply this on particular text filed not for all the password fill. I dont have form tag but want to apply this on password fill.

Please suggest on this.

from disableautofill.js.

Related Issues (20)

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.