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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:26:22+00:00 2026-06-13T10:26:22+00:00

I wanna pass an object from jquery using a selector to a javascript function

  • 0

I wanna pass an object from jquery using a selector to a javascript function like below.

flash($("#something span"), "#fff", 250);

but it does not seem to be working.

and I am not sure what to put in the javascript function.
What I make now is:

function flash(obj,color1,color2,duration) {
    obj.animate({backgroundColor:color1},duration);
    setTimeout(function(){this.animate({backgroundColor:color2},duration);},duration);
}

or is there another way instead of passing an object? for example, in jquery:
$(“this”).flash(“#f79999”, “#eee”, 250);

but then how to define the javascript function?

  • 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-13T10:26:23+00:00Added an answer on June 13, 2026 at 10:26 am

    You’ll have to include the jQuery.Color plugin to animate properties like background-color.

    From “Animation Properties and Values:”

    All animated properties should be animated to a single numeric value, except as noted below; most properties that are non-numeric cannot be animated using basic jQuery functionality (For example, width, height, or left can be animated but background-color cannot be, unless the jQuery.Color() plugin is used). […]


    is there another way instead of passing an object? for example, in jquery: $(“this”).flash(“#fff”,250);

    jQuery’s Plugins/Authoring should help with this. But, you could define it as:

    jQuery.fn.flash = function (color, duration) {
        return this.animate({ backgroundColor: color }, duration);
    };
    
    $('#something span').flash('#fff', 250);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna run selenium tests from TeamCity using Maven at Linux server without display.
I have created two arrays. I wanna pass these two array to any function.
I wanna know is this possible I pass get parameters for a javascript file
I wanna to detect an input tag that its name is: some[en] in jquery.
I am using UIWebView to display pdf. I wanna handle touch events on webview.
I wanna pass parameter to Custom View at runtime. is that possible? <custom.analog.clock.AnalogClock1 android:id=@+id/clock
Hey so i'm making a function that gathers up sprites that you wanna keep
I have two tables user and treeview . From my registration form I wanna
I wanna kn is it possible to pass query string along with URL when
I have an array of objects where I wanna only save a sub object

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.