Git Product home page Git Product logo

add-clear's People

Contributors

cezarykluczynski avatar deividy avatar jameswragg avatar kaiyoma avatar skorecky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

add-clear's Issues

Add bower.json

Hi I'm unable to consume this package properly with bower. Can you add a bower.json pls?

cross browser

Buenas, este plugin funciona con ie8? no me está andando

salduso!

Small addition that I found very useful...

I realize you don't support this add-in, but I've found it useful, so thanks! Also, I added one feature that I really needed, and thought I'd pass it back to you. Since .change() is horrible for inputs, and the alternative seems to be to use a .keyup() listener, I needed to be notified that the field had been cleared, since it doesn't generate an event. So I added onClear: null to the options, and in the click function I added:

                    if (options.onClear){
                        options.onClear($(this).siblings("input"));
                    }

And now I can do this type of thing:

$("#myinput").addClear({
  onClear: function(e) {
  // do something
}});

Thanks again for your work!
Dave

Noisy license

The license comment in the minified version is a bit much. Maybe it's enough to include an URL to your license instead of including the MIT license text (just like others, e.g. jquery are doing it)?

This applies to version 2.0.5 (newest bower version). The newer minified versions don't seem to have any license header which is a bit weird too.

Version discrepancies

In package.json it says 2.0.7, in the file header it says 2.0.6, with bower the hightest available version is 2.0.5.

Problem when use it with bootstrap

In the Boostrap 3, the inputs are often added class "form-control" with z-index = 2. That cause the error that we can't click icon X to clear text. We fixed this problem by adding z-index = 3 when tag a is created in the file addclear.js. Could you tell me better way? Sorry for my english.

Don't replace inputs with divs

Unlike #26 suggests putting <input> inside <span> is valid because both are inline-elements. Replacing an inline element with a <div> like this plugin does now can lead to invalid html.

Callback fires multiple times

If you apply addClear to multiple elements the callback is apply X times as it is bound to the close button but not in context to its instance:

$("a[href='#clear']").click(function(e) {...

License?

what is the license of this? MIT? Please add. thx

autocomplete

I was playing around with your plugin for form data when I noticed a bug. When autocomplete is on such that when you load the page and the input box is already populated, pressing the 'x' button removes the pre-populated text from view, yet still allows you to submit the form as if the text had not been deleted.

Couple of suggestions for improving the project

I'm interested in using add-clear in my project, but there are a couple enhancements I'd need to have first before it would work for me.

First, the clear button competes with the clear button that already exists in IE11 and Edge, creating a wonky scenario with one 'x' on top of the other. I think it'd be great if your code could disable the built-in clear button automatically (just for those browsers), but if you'd rather make that an option that defaults to false, I'd be happy with that too. Some quick research turned this up:

https://developer.mozilla.org/en-US/docs/Web/CSS/::-ms-clear

Second, if you fill the field with text, the 'x' is displayed on top of the text, which, again, looks bad. Adding padding-right of 20px seems to fix the issue nicely. Again, I'll leave it up to you if you want to make this default behavior or an option that defaults to false. There could be some interaction between this option and the first one I suggested, as the Microsoft browsers automatically add padding so their built-in clear button doesn't run into this problem.

What do you think?

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.