0

My question is very similar to this one.

I really thought that <input type="text" name="StackOverflow1370021" value="Fix IE bug" style="{display:none}" /> would fix this.

For clarity, I want the Enter button to do what the "Change" button does. http://jsfiddle.net/RASgx/

Community
  • 1
  • 1
Kaninepete
  • 1,227
  • 2
  • 10
  • 12

4 Answers4

2

You need to add a return false; to make it not submit

<form name="text" onSubmit="document.getElementById('change').innerHTML=parseInt(document.getElementById('change').innerHTML)+parseInt((text.elements.field.value));return false;">

Updated version (3) of your jsFiddle

RichardTheKiwi
  • 102,799
  • 24
  • 193
  • 261
0

Although this is highly not recommended, you can add in the onsubmit at the end:

return false;

here is a fork of your code

Cu7l4ss
  • 546
  • 1
  • 7
  • 19
0

Change your tag to: <form name="text" onSubmit="document.getElementById('change').innerHTML=parseInt(document.getElementById('change').innerHTML)+parseInt((text.elements.field.value)); return false;"> That will prevent the form from being submitted.

fabsn
  • 234
  • 2
  • 11
0

add return false; to your onSubmit handler to prevent the default.

Gabriel
  • 17,724
  • 2
  • 36
  • 42