On Submit show Alert Box

I'm trying to figure out how when I hit the submit button I can have a box pop up that says

"Thanks for giving your opinion"

I tried the below code, but not working.

<form action="submitsurvey.php" onsubmit="alert('Thanks for giving your opinion');" enctype="multipart/form-data" method="post">
									<div class="radio">
										<input name="option" type="radio" class="off" value="'.$row3['id'].'"/>
										<a class="custom"></a>
									<div class="text">
										<label for="option" style="word-wrap:break-word;width:300px;">'.$row3['answer'].'</label>
<input type="submit" class="btn blue" value="SUBMIT">

Open in new window

LVL 12
Nathan RileyFounderAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ray PaseurCommented:
<form action="submitsurvey.php" enctype="multipart/form-data" method="post">
<input type="submit" class="btn blue" value="SUBMIT" onClick="alert('Thanks for giving your opinion');">

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If you want full control over the submission, change the button type from SUBMIT to BUTTON, and add an onclick hander that calls a function:

function submitForm()
  //perhaps some client validation here
  alert("Thanks for submitting.")
<input type="button" onclick="submitForm();" name="go" value="Go" />

Open in new window

In reality, you probably want to do validation and checking for successful form submission on the server, as a 'thank you' message should only be presented if the form was actually submitted correctly.
jjkkj jknykykCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.