HTML button avoid submit If you had the problem that the button makes a submit but you just want to run a JavaScript you had to add the type “button” to avoid this, like this: XHTML <button type="button" onclick="run();">TRY</button> 1 <button type="button" onclick="run();">TRY</button>