<button onclick="alert('Hello'); return false;">Hello</button>
What is the return false part supposed to do? Also, what would return true do if it were there?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The default button type is
submit, so<button>is the same as<button type="submit">(except on IE). Thereturn falsestops the default button action so it will stop form submission from happening.You can avoid that by defining the button type explicitly