I have a simple form whose action posts to a basic PHP script. The problem I have discovered is that if someone is typing fast and accidently has the Shift key down when they hit " Enter
" a whole slew of PHP error messages pops up. How can I allow Shift + Enter
to work just like " Enter
" or at least prevent all the error messages from popping up?
Currently I do not have any Javascript in use with this form. The submit button is simply <button class="submit button" type="submit">Update</button>
Assuming you are using jQuery...
$('input').keyup(function (event) {
if (event.keyCode == 13 && event.shiftKey) {
event.stopPropagation();
}
});
Alternate to using directly with Javascript (might need to test it out)...
document.getElementsByTagName("input").onkeyup=function(event){
if (event.keyCode == 13 && event.shiftKey)
{
event.stopPropagation();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.