Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

emptying input value #90

Open
catalystweb opened this issue Oct 29, 2021 · 0 comments
Open

emptying input value #90

catalystweb opened this issue Oct 29, 2021 · 0 comments

Comments

@catalystweb
Copy link

I know there was an issue that was raised regarding this, but the applied fix doesn't work for me. (discussed here )
I want the user to be able to clear the value of the input, however it defaults to '#FFF'. How I fixed it was,

  1.  $(_$UI).hide(_options.animationSpeed, function() {
       // preRender(false); 
       _colorPicker.$trigger = null;
     }).off('.tcp');
    
  2. .on('change.tcp', function() {
       _color.setColor(this.value || '#FFF');
       //_this.colorPicker.render(true); 
     })
    

(1) The preRender function appears to setup the properties and values to initially load a picker, why its called in the hide method I don't understand ? commenting this out stopped the default values from being applied to the field when the user clicked or tabbed out of the field.
(2) The render(true) property calls the preRender function which as with 1. overwrites the field value. Commenting this out stopped this, furthermore you could remove the on change handler entirely as setColor is applied during preRender and toggle functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant