The js code for the form is not allowed to submit Spaces
- 2020-03-29 23:49:12
- OfStack
When I was working on the project, I used ckeditor on a page, but there was a problem, I pressed the enter key whenever there was a text box, and it would automatically refresh. Finally, I found a solution:
As long as in each input textbox binding,onkeydown() event. Js code is 13.
I use jquery. Because most of the time, we use event event, which is not compatible with other browsers, so using jquery which can be used for all kinds of browsers
<input type="text" name="mes.mesTitle" value="<s:property value='mes.mesTitle'/>" class="InputStyle" onkeydown="keydown(this)"
As long as in each input textbox binding,onkeydown() event. Js code is 13.
function keydown(text){
$j(text).keydown(function(e){
if(e.which==13){
e.preventDefault();
}
});
}
I use jquery. Because most of the time, we use event event, which is not compatible with other browsers, so using jquery which can be used for all kinds of browsers