This article mainly introduces the method of submitting js and jquery carriage return. The example analyzes the techniques of monitoring and corresponding carriage return keys in js and jQuery for submission, for more information about how to submit js and jquery keys, see the example in this article. Share it with you for your reference. The details are as follows:
1. JavaScript method:
Script document. onkeydown = function (event) {e = event? Event :( window. event? Window. event: null); if (e. keyCode = 13) {// method of execution alert ('Carriage return detected ');} script, script, document. onkeydown = function (event) {e = event? Event :( window. event? Window. event: null); if (e. keyCode = 13) {// method of execution alert ('Carriage return detected ');} script
2. jQuery method:
Script $ (document ). ready (function () {$ ("Press ENTER control "). keydown (function (e) {var curKey = e. which; if (curKey = 13) {$ ("# Press ENTER event button control "). click (); return false ;}}) ;}; script
I hope this article will help you design javascript programs.