Home › Forums › General Issues › Disabling click on Color picker?
Hello good people,
Is it possible to disable click on color picker?
I’m asking this because I have radio buttons that define what color style user want to show on a page, and color picker is just to show visually color of the style. That is why I need to disable click on color picker.
If there us some delicate way to do this, I’m open to suggestions 😉
I honestly cannot tell you if this is possible or not. The color picker is this https://github.com/jquery/jquery-color, the standard wp jquery color picker. If it’s possible it would need to be possible in this plugin. You would need to add custom JS to your site and access the color picker https://www.advancedcustomfields.com/resources/adding-custom-javascript-fields/, the color picker args hook is at the end of the page.
If you already have a radio button that allows picking of specific colors, you can alter the radio field to show those colors by including HTML in the “label” portion and then you can add custom CSS to your admin to style that HTML to show the correct color,
or you can even add they styling inline. For example, I used something like this on a site to display a block of color around the label that shows the color being selected.
#f5f5f5 : <span style="display: inline-block; padding: 0 2px; background-color: #f5f5f5; color: #191919;">Light (#f5f5f5)</span>
#191919 : <span style="display: inline-block; padding: 0 2px; background-color: #191919; color: #FFF;">Dark (#191919)</span>
site_colors_company : <span style="display: inline-block; padding: 0 2px; background-color: #006fb6; color: #FFF; font-weight: bold;">company</span>
site_colors_company_2 : <span style="display: inline-block; padding: 0 2px; background-color: #99cc00; color: #FFF; font-weight: bold;">company 2</span>
site_colors_cta : <span style="display: inline-block; padding: 0 2px; background-color: #ff7f00; color: #FFF; font-weight: bold;">CTA</span>
You can probably even do away with the text and just show a block of color, there are a lot of possibilities here.
Thank you for long answer, i will investigate possible solution on this topic and will return to say my result 😉
Differently you show me the path 😀
Sadly no, client agree that color picker is just to show picked color by select field 😀
Damn, was hoping you had a way… Disabling text inputs is no prob but this color thing…
Adding a class hidden (which is display: none) doesn’t seem to work either (for me).
Yep, I had no time to investigate, and the client just didn’t want to pay extra money for this, so I give up.
The topic ‘Disabling click on Color picker?’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.