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,357
  • 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
  • 105,798
  • 26
  • 196
  • 262
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
  • 556
  • 1
  • 8
  • 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.

fabian-mcfly
  • 231
  • 2
  • 12
0

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

Gabriel
  • 18,322
  • 2
  • 37
  • 44