I'm learning Rails and I'm working with a Rails web app. It has an "Order" button, and when I click it, it says: "Thank you for ordering". It's done using the flash action. I would like the message to fade away after 5 seconds. I added this code:
$(document).ready(function() {
$("#notice").fadeOut("slow");
});
This script is inside the views/layout folder and is linked to the application.html.erb file inside the same folder. However, it is not working. What am I doing wrong and how can I fix it?