Comments (13)
Oh I think I finally understand, I didn't notice earlier that the picked color and the color of the button were different. This is not supposed to happen, it looks like a bug. Is there anyway I can take a look at your page and do a couple tests?
from coloris.
I just took a look at the code for jQuery.trigger() and it seems it only works for event listeners created with jQuery. So what you need is to trigger an "input" event with vanilla JavaScript. Try this code right after you change the color value:
document.querySelector("input[name=edit_date_type_couleur]").dispatchEvent(new Event('input', { bubbles: true }));
I hope this time it works.
from coloris.
I'm not sure what you are asking exactly, but if you want to change the label of the small button next to your input field:
You can do it like this:
Coloris({
a11y: {
open: 'Open color picker' // Your label here
}
});
Please note that the label is mostly used to make color picker accessible to people who use screen readers.
from coloris.
I have an html block with a colorpicker field.
I have several buttons that allow me to change the color of the field. The only concern for now is that the label is not refreshing (the color). On the other hand, when you click on the colorpicker, I can see the correct color.
So basically, i need a refreshColor function. (Sorry for my bad english)
from coloris.
Thanks but, To tell the truth, it's in the backend of a wordpress module developed to measure for the company I work for. I unfortunately cannot give you access, but I can give you all the information you want and how I use your plugin.
So I have a hidden HTML block. When I press the edit buttons, it brings up the html block and changes the color of the colorpicker.
When you click on the button for the first time, the color is updated, even in the label. But after the first click and therefore initialization, the label is no longer updated.
For the moment, I refresh the colorpicker field by initializing the class. Is there another way like a Coloris.updateColor ("# ff0000");
from coloris.
I'm not sure since I can't test it, but I think you probably remove the input field from the DOM tree which removes the event listener that I use to update the "label" when the color changes. In that case, you can call Coloris.wrap(selector) after showing the input field.
If you don't use a custom selector when initializing the color picker this should work:
Coloris.wrap('data-coloris]');
If you are using a custom selector:
Coloris.wrap(yourSelector);
from coloris.
@arnaudboi Was your problem resolved? Let me know so I can close this issue.
from coloris.
Hello, unfortunately, it doesn't change anything.
As you can see, each time a button is clicked, I initialize Coloris and then add wrap.
Unfortunately, this only works on the first Click. Then the label only does not update.
Should I proceed otherwise?
from coloris.
I see! You update the value of the color field programmatically with jQuery. In that case, all you need to do is to trigger an "input" event on the field:
jQuery("input[name=edit_date_type_couleur]").trigger("input");
You don't need to call Coloris.wrap() anymore.
from coloris.
I tried with your code, unfortunately it still doesn't work :(
from coloris.
You need to add that code right after you change the value of the color. So your code should look like this:
...
jQuery("input[name=edit_date_type_couleur]").val(date_type_couleur);
jQuery("input[name=edit_date_type_couleur]").trigger("input");
...
from coloris.
Perfect, it works. Thank you for the time you gave me and the great plugin you created! Good continuation
from coloris.
Glad I could help!
from coloris.
Related Issues (20)
- NaN values when inline color picker HOT 7
- Open method HOT 3
- clr-open-label not initialized on osX HOT 4
- Add 'Cancel' button (or any custom button) HOT 5
- Materializecss compatibility HOT 2
- Popup Input Issue HOT 3
- Mouse does not lineup on palette after scrolling in scrollable container HOT 3
- Include SCSS file with variables HOT 10
- Add support for CSS custom properties (variables) HOT 1
- Colorpicker wraps all input fields on page load HOT 5
- I would like to contribute sass/scss to the repository HOT 4
- ARIA: issue with Inline `#clr-color-marker` HOT 6
- Incorrect output value of alpha channel in 8-digit Hex Code HOT 8
- The color picker doesn't stick to the input it scrolls along HOT 2
- Option to not style the input element HOT 8
- Make `el` and `parent` options accept `Node` HOT 12
- colorArea doesn't handle right mouse button HOT 2
- Feature Request: Add Eyedropper HOT 2
- Missing info in docs about setting up thumbnails HOT 4
- Not showing in absolute positioned div HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coloris.