I am currently adjusting my website to Google Chrome. While working on it, I noticed something weired. As part of the site, I use HTML buttons and I run different functions when people click them. What I noticed is that when I click the buttons, they go to the function I assigned, but try to submit the form after that. This only happens in Chrome (maybe in Safari, but I didn't check). This unintended reaction ruins my functionality. Has this happened to anyone? is there a way to overcome the problem?
OK, I took care of it. All you need to do is use "return false" after calling the function. For example: <input type='button' value='check' onclick='javascript:doThis(); return false;' />
Weird! You sure these are buttons and not submits ?! Returning false is used when you don't wanna submit a form via <input type='submit'. I haven't got any problems with <input type='button'... in Chrome.