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 8050377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:04:43+00:00 2026-06-05T07:04:43+00:00

I know there is plugin called .hasClass(); I have the following $(‘#page_background, #header_background’).ColorPicker({… how

  • 0

I know there is plugin called .hasClass();

I have the following

$('#page_background, #header_background').ColorPicker({...

how would I check if page_background is clicked and not header_background?

This is what I have now, it won’t work.

$('#page_background, #header_background').ColorPicker({
        onSubmit: function(hsb, hex, rgb, el) {
            $(el).val(hex);
            $(el).ColorPickerHide();

            var id = this.id;

            if(id == 'page_background')
                $('body').css("background-color","#"+hex);
        },
        onBeforeShow: function () {
            $(this).ColorPickerSetColor(this.value);
        }
    })
    .bind('keyup', function(){
        $(this).ColorPickerSetColor(this.value);
    });
  • 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-05T07:04:44+00:00Added an answer on June 5, 2026 at 7:04 am
    $(function(){
       $('#page_background, #header_background').click(function(){
    
       var id = this.id;
       if(id == 'page_background')
         // page background
       else
         //header 
     });
    });
    

    Working fiddle

    As you are using this inside colorpicker onSubmit function

    onSubmit: function(hsb, hex, rgb, el) {
    

    where you get the element as el, so to get the id use

     var id = $(el).attr('id');
     // or
     var id = $(el).prop('id'); // new way
     //or simply
     var id = el.id; // this should work too
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know,If there is a Hudson plugin to reduce the build
I know there is xmlrpc plugin for trac. But I is not my trac
I am learning Hibernate , I just want to know is there any plugin
I am using a tooltip plugin called qTip2. I would like to be able
I know there is an extension called Dust-Me Selectors for Firefox and also that
In vim, there is this amazing plugin called command-t, that lets you fuzzy-search through
I have this Editor with me called jWYSIWYG, its basically a Jquery Plugin. So
There is a FireFox plugin called greasemonkey with which you can execute some piece
I am programming c# in VS2010 and have been testing out a plugin called
I have a function that's called by a link which should check various checkboxes

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.