Re: ltiong_sh's suggestion
The above does not work with Internet Explorer, at least IE8 and below.
For IE8 and below, the following will work:
document.onkeypress = function keypressed(){
if (window.event.keyCode == 13) {
// Sumbit code
}
}
However, this is not what is important. Important is that this method is very bad:
1) Every keypress is monitored when you are within the input text area or whenever you are in the page (depending on the method used)! (This might steal CPU time)
2) A new page is issued on pressing Enter (or other hot key) with the same URL! That is, the page stacks itself up in history each time Enter is pressed!!!
3) The text within the input area is restored to the default (original one) after pressing Enter!!
4) The submitted text is added to the URL in the address area, as ?
I have not found any way until now to overcome these drawbacks ... (It's the first time today that I'm searching how to press Enter to submit a text (as an alternative to clicking a button).
Is there someone out there to suggest a more effective method?