# Changing the color of :highlight

**URL:** <https://www.ruby-forum.com/t/changing-the-color-of-highlight/60060>\
**Category:** Rails\
**Created:** [May 9, 2006, 9:41pm UTC](https://www.ruby-forum.com/t/changing-the-color-of-highlight/60060 "2006-05-09T21:41:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [May 9, 2006, 9:41pm UTC](https://www.ruby-forum.com/t/changing-the-color-of-highlight/60060/1 "2006-05-09T21:41:22Z")

</div>

Is there an easy way to change to color of the :highlight effect?

:complete =\> visual\_effect(:highlight, “targetid”, :duration =\> 1)

thanks

---

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [May 9, 2006, 10:04pm UTC](https://www.ruby-forum.com/t/changing-the-color-of-highlight/60060/2 "2006-05-09T22:04:59Z")

</div>

On 09 May 2006, at 21:41, Ben wrote:

> Is there an easy way to change to color of the :highlight effect?
> 
> :complete =\> visual\_effect(:highlight, “targetid”, :duration =\> 1)

:complete =\> visual\_effect(:highlight, “targetid”, :duration =\>  
1, :startcolor =\> “#88ff88”, :endcolor =\> “#114411”)

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [May 9, 2006, 10:22pm UTC](https://www.ruby-forum.com/t/changing-the-color-of-highlight/60060/3 "2006-05-09T22:22:31Z")

</div>

Thanks Peter, but I can’t seem to get that to work. The ajax works as  
planned, but then there is no highlight at all.

---

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [May 9, 2006, 11:34pm UTC](https://www.ruby-forum.com/t/changing-the-color-of-highlight/60060/4 "2006-05-09T23:34:11Z")

</div>

On 09 May 2006, at 22:22, Ben wrote:

> Thanks Peter, but I can’t seem to get that to work. The ajax works as  
> planned, but then there is no highlight at all.

Maybe you should put curly braces {} around all parameters after the  
targetid.

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [May 9, 2006, 11:47pm UTC](https://www.ruby-forum.com/t/changing-the-color-of-highlight/60060/5 "2006-05-09T23:47:02Z")

</div>

Element.highlight which is what the RJS eventually gets translated to  
tries to figure out the background colour of the element who’s id you  
pass in. If in can’t figure it out then you have to explicitly set the  
colour of the background using CSS for the target element.

Cheers

## Jonathan

> **[AgileEvolved.com is for sale | HugeDomains](https://www.hugedomains.com/domain_profile.cfm?d=agileevolved.com)**
>
> Own this domain today. We make your shopping experience easy. Friendly and quick customer service.
