JQuery removes the carriage return and jquery returns the line feed.
. Replace (/[\ r \ n]/g, "") // remove the carriage return and line feed.
==================
In js, if there is a line feed js syntax, it will be considered wrong. Today, this problem is thought that the jQuery method has a limit on the length of the string or a limit on the default length of form input.
Finally, I checked for half a day and found that it was a line feed, resulting in js errors. Replace the line feed with an empty string.
The carriage return is intercepted before the JS line feed to prevent line feed from being compatible with Firefox. Do not use Jquery.
// Document. onkeydown = function (evt ){
// E = e? E: window. event;
Function keyenter (evt)
If (evt = window. event ){
If (evt. keyCode = 13)
{
Alert ("test ");
Return false;
}
}
Var keyCode = e. which? E. which: e. keyCode;
If (keyCode = 13)
{
Return doSubmit (); // call the form verification function when you press the "enter" key.
}
}
} Else //! IE
{
If (evt. which = 13)
{
Alert ("test ");
Evt. cancelBubble = true;
Evt. preventDefault ();
Evt. stopPropagation ();
}
}
Jquery shields carriage return for submission but does not block line feed
Press enter to submit. Generally, it is a trigger button event. You can judge it on the button.