I was going through some source code on an internal application at work, and I noticed something that I thought was strange.
Below is the html code in question.
<input type='submit' onclick='return doSomething()' value='Stuff Here'>
And this is the JS function
function doSomething() {
//open a window with an aspx page that pulls down a pdf
//always returns false
return false;
}
So my question. How is that any different than making the input type='button' and simply calling the function without forcing a return value of false? I understand that the way it was done cancels form submission, but if you never want it to submit a form, why make it a type of submit in the first place?