Skip to content

Instantly share code, notes, and snippets.

@mreidsma
Created March 21, 2012 20:11
Show Gist options
  • Save mreidsma/2152334 to your computer and use it in GitHub Desktop.
Save mreidsma/2152334 to your computer and use it in GitHub Desktop.
Randomize the confirmation message displayed after form submission
// Have a span with the id of feedback-thanks in your document.
var ran1 = ["Thank you! Your feedback is important to us.","Thanks! Your feedback helps us find the best tools for you.","Thank you! Your feedback helps everyone doing research at GVSU."];
var randomNum = Math.ceil(Math.random()*3); /* Pick random number between 1 and 3 */
document.getElementById("feedback-thanks").innerHTML = ran1[randomNum];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment