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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:49:36+00:00 2026-05-11T02:49:36+00:00

I have an element in my document that has a background color and image

  • 0

I have an element in my document that has a background color and image set through a regular CSS rule.

When a certain event happens, I want to animate that item, highlighting it (I’m using Scriptaculous, but this question applies to any framework that’ll do the same).

new Effect.Highlight(elHighlight, { startcolor: '#ffff99', endcolor: '#ffffff', afterFinish: fnEndOfFadeOut }); 

The problem i’m facing is that after the animation is done, the element is left with the following style (according to FireBug):

element.style {   background-color:transparent;   background-image:none; } 

Which overrides the CSS rule, since it’s set at the element level, so I’m losing the background that the item used to have…

What I’m trying to do is, in the callback function I’m running after the animation is done, set the style properties to a value that’ll make them "go away".

var fnEndOfFadeOut = function() {   elHighlight.style.backgroundColor = "xxxxx";   elHighlight.style.backgroundImage = "xxxxx"; } 

What I’m trying to figure out is what to put in "xxxx" (or how to do the same thing in a different way).
I tried ‘auto’, ‘inherit’, and ” (blank string), and neither worked (I didn’t really expect them to work, but I’m clueless here).

I also tried elHighlight.style = ""; which, expectably, threw an exception.

What can I do to overcome this?
I know I can put a span inside the element that I’m highlighting and highlight that span instead, but I’m hoping I’ll be able to avoid the extra useless markup.

  • 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. 2026-05-11T02:49:37+00:00Added an answer on May 11, 2026 at 2:49 am

    Chances are you’re not setting the style on the correct element. It’s probably being set somewhere up the line in a parent node.

    elHighlight.style.backgroundColor = ''; elHighlight.style.backgroundImage = ''; 

    You can also remove all the default styling by calling:

    elHighlight.style.cssText = ''; 

    In any case, you’ll still have to do this on the specific element that is setting these properties, which means you may need to do a recursion on parentNode until you find it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a xml document that has a record set like this. <document> <row>
I have a document that looks something like <root> <element> <subelement1 /> <subelement2 />
why when i write document.getElementByClass('home1').setAttribute('style', 'background-image:url(img/red_menu.PNG);'); it doesn't work? i have the element with
I have an xml document that has a structure like so: <?xml version=1.0 encoding=iso-8859-1
I have an element that has two classes but can't seem to select it
I have an XML document that has a TextBlock that contains HTML code. <TextBlock>
I have a page with an iframe that has an html document within it.
I have a div element, that has no defined width or height. It holds
I am using XSLT 1.0 Suppose I have an xml that has certain num
I currently have an HTML page that has a grey BODY background. Now I

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.