After taking some jQuery lessons, I have attempted to write my first program - a simple fortune teller program. You ask a question (right now for love, happiness or money) and the program takes the question, splits it into an array and then loops through the words for a keyword. Depending on the keyword, one of ten random answers is returned. The problem I am having is that sometimes it gives the answer but only for a split second and then resets itself, or sometimes the h1 text where the answers are returned, suddenly is empty. Any ideas, comments, suggestions, or polite critiques are welcome and appreciated. Thank you!
Here is the link to the program in action: http://laurelnatale.me/fortune/ You can currently ask it questions with love, money, wealth, happy, happiness.
Here is the code: http://laurelnatale.me/fortune/fortune.js