# How to ajax highlight a flash\[\]

**URL:** <https://www.ruby-forum.com/t/how-to-ajax-highlight-a-flash/100457>\
**Category:** Rails\
**Created:** [July 29, 2006, 1:03am UTC](https://www.ruby-forum.com/t/how-to-ajax-highlight-a-flash/100457 "2006-07-29T01:03:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![blair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c37758/32.png) [@blair](https://www.ruby-forum.com/u/blair)\
**Post date:** [July 29, 2006, 1:03am UTC](https://www.ruby-forum.com/t/how-to-ajax-highlight-a-flash/100457/1 "2006-07-29T01:03:07Z")

</div>

Hi,

I want to make a flash[] highlighted for let’s say 5 seconds when some  
action is invoked.

In the controller, I have:  
flash[:notice] = “error”

In the layout, I have:

\<%= flash[:notice] %\>

I don’t know how to use ajax with the flash. I tried something like:  
element.highlight(flash[:notice])

without any success. Do I have to put it inside a

 with an id or  
class? Can somebody help me?

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![blair](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c37758/32.png) [@blair](https://www.ruby-forum.com/u/blair)\
**Post date:** [July 29, 2006, 1:41am UTC](https://www.ruby-forum.com/t/how-to-ajax-highlight-a-flash/100457/2 "2006-07-29T01:41:38Z")

</div>

On Friday, July 28, 2006, at 11:05 PM, Eric B. wrote:

> –  
> Posted with [http://DevLists.com](http://DevLists.com). Sign up and save your mailbox.
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

I stuck this at the bottom of my ‘application.rhtml’ file…

\<%= javascript\_tag(“new Effect.Highlight(‘flash’);new  
Effect.Fade(‘flash’, {duration:10});”) if flash %\>

This highlights the flash, if there is one, and then it fades out  
completely over a longer period.

\_Kevin  
[www.sciwerks.com](http://www.sciwerks.com)
