Reputation: 1447
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/
Upvotes: 0
Views: 293
Reputation: 18780
add return false;
to your onSubmit handler to prevent the default.
Upvotes: 0
Reputation: 229
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.
Upvotes: 0
Reputation: 566
Although this is highly not recommended, you can add in the onsubmit at the end:
return false;
here is a fork of your code
Upvotes: 0
Reputation: 107716
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
Upvotes: 2