Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7904099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:54:46+00:00 2026-06-03T09:54:46+00:00

I am developing a wordpress theme. I am working on the theme options page

  • 0

I am developing a wordpress theme. I am working on the theme options page right now. I added farbtastic (4 fields) and the problem is that every time I click on the input, the color picker appears on the other 3 fields too. Anybody knows how to fix this? Thank you!

<div> <br />
  <label for="<?php echo $colorPicker['ID']; ?>"><?php _e($colorPicker['label']); ?></label>
  <input type="text" class="color-picker" id="<?php echo $colorPicker['ID']; ?>" value="<?php echo get_option($colorPicker['ID']); ?>" name="<?php echo $colorPicker['ID']; ?>" />
  <div id="<?php echo $colorPicker['ID']; ?>_color" class="fabox"></div>            </div>          
<?php endforeach; ?>            
<p><input type="submit" name="update_options" value="Update Options" class="button-primary" /></p>
</form>
</div>

<script type="text/javascript">
jQuery(document).ready(function($) {
    var colorPickers = $('.color-picker');
    console.log(colorPickers);
    for (e in colorPickers) {
        if (colorPickers[e].id != undefined) {
            var colorPickerID = colorPickers[e].id;
            $('#' + colorPickerID + '_color').farbtastic('#' + colorPickerID);
        }
    }

    $('.fabox').hide();


    $('.color-picker').click(function() {
        $('.fabox').fadeIn();
    });

    $(document).mousedown(function() {
        $('.fabox').each(function() {
            var display = $(this).css('display');
            if (display == 'block') $(this).fadeOut();
        });
    });
});​
</script>

HTML OUTPUT:

<form method="POST" action="">  

                        <div>

            <br />

            <label for="color_1"><strong>Post Title</strong></label>

            <input type="text" class="color-picker" id="color_1" value="#273990" name="color_1" />

            <div id="color_1_color" class="fabox"></div>

            </div>

                        <div>

            <br />

            <label for="color_2"><strong>Paragraph Text</strong></label>

            <input type="text" class="color-picker" id="color_2" value="#840000" name="color_2" />

            <div id="color_2_color" class="fabox"></div>

            </div>

                        <div>

            <br />

            <label for="color_3"><strong>Example</strong></label>

            <input type="text" class="color-picker" id="color_3" value="#4377df" name="color_3" />

            <div id="color_3_color" class="fabox"></div>

            </div>

                        <div>

            <br />

            <label for="color_4"><strong>And Another Example</strong></label>

            <input type="text" class="color-picker" id="color_4" value="#3c8400" name="color_4" />

            <div id="color_4_color" class="fabox"></div>

            </div>

                        <p><input type="submit" name="update_options" value="Update Options" class="button-primary" /></p>

        </form>

    </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:54:48+00:00Added an answer on June 3, 2026 at 9:54 am

    You’re referencing too broad of an element with your jQuery selector. Essentially your code says every time you click anything with the color-picker class, show anything with the fabox class.

    You should make your reference more specific to the currently clicked .color-picker.

    I recommend replacing this:

    $('.fabox').fadeIn();
    

    With this:

    $(this).parent().find('.fabox').fadeIn();
    

    So you are only referencing the .fabox that is connected to the .color-picker you just clicked.

    EDIT: As gillesc noted, it would actually be quicker to use:

    $(this).next().fadeIn();
    

    So long as the the .fabox always follows the .color-picker.

    If the .fabox was inside the same container, but not the very next element you could use:

    $(this).next('.fabox').fadeIn();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently developing a custom WordPress theme and ran into a problem. I
I starting working with WordPress as a CMS, now that the V3 makes it
I'm developing a Wordpress theme. One of the sections on the front page is
I'm developing a custom WordPress theme for a company, and I'd like to keep
I'm developing a custom wordpress blog theme. Does anyone know if there is a
I'm developing http://pizzli.com/darrenwp as a WordPress Theme. For some reason, I cannot get the
I'm developing a wordpress 3.3.1 theme and I'm having troubles with the single.php file.
I'm currently developing a site using the WordPress Twenty Eleven theme and I would
I'm developing a WordPress 3.0 theme, my first theme with a bit of jQuery
I'm developing a wordpress theme for general release. I want to display an image

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.