T
Tim Streater
I see various sites that use <button>s with attached onclick events to
perform some action if the button is clicked. But these particular sites
don't have these buttons as form controls - they are not submitting a
form and want a button so they use it. This seems to work, but is it
defined behaviour? Is it reliable cross-browser?
All these buttons were like this:
<button id='abc'>sometext</button>
but with no <form> anywhere. I tried using a cut-down version of the
page for some testing and was bitten by being too good and putting a
<form> around the buttons without remembering what the default type of a
button is in a form.
perform some action if the button is clicked. But these particular sites
don't have these buttons as form controls - they are not submitting a
form and want a button so they use it. This seems to work, but is it
defined behaviour? Is it reliable cross-browser?
All these buttons were like this:
<button id='abc'>sometext</button>
but with no <form> anywhere. I tried using a cut-down version of the
page for some testing and was bitten by being too good and putting a
<form> around the buttons without remembering what the default type of a
button is in a form.