I have the following code (inherited from someone):
<div class="feedback"> </div>
<form onsubmit="return false" autocomplete="off">
Enter your guess:
<input type="text" size="48" id="guessedword"/>
<input type="submit" value="Guess!" id="guessbutton"/>
</form>
</div>
Now, I want to do something when the “Guess!” button is pressed, but I don’t want the page to change (i.e. I don’t want the form submitted). That’s why the onsubmit is mapped to "return false". I also have the following JQuery:
$("#guessbutton").bind("click", onGuess);
The thing is, this works great in Firefox and Chrome. The only problem is IE. The guess button works correctly, the only problem is that when pressing Enter in the text field, the button isn’t pressed, or at least the onClick behavior is never called. In Firefox and Chrome, it works great.
Is there any way to make this work the way I want it? Or am I going about this whole thing the wrong way? (I’m new to HTML, so I’m not even sure this is the right way to do things).
Thanks
you can write :
This will not redirect enter to onclick, but in all the three browsers, Enter is equivalent to submitting the form.. so u write ur login in onSubmit and the return false that the page does not get submitted again.