Skip to content

Instantly share code, notes, and snippets.

@baldwindavid
Created August 5, 2011 18:23
Show Gist options
  • Save baldwindavid/1128167 to your computer and use it in GitHub Desktop.
Save baldwindavid/1128167 to your computer and use it in GitHub Desktop.
$(function() {
$(".flash").livequery(function(){
$(this).delay(5000).fadeThenSlideToggle();
});
});
<% if @item.valid? %>
jQuery("#some-element").prepend("<div class='flash notice'>Item created!</div>");
<% else %>
jQuery("#some-element").prepend("<div class='flash error'><%= escape_javascript(render('shared/error_messages', :target => @item)) %></div>");
<% end %>
@mileszs
Copy link

mileszs commented Aug 5, 2011 via email

@baldwindavid
Copy link
Author

Well, I probably never would have noticed, but was just recently dealing with a #flash in a single place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment