Jquery captures the Enter key and obtains the checkbox value and the asynchronous request method,
This document describes how jquery captures the Enter key and obtains the checkbox value and asynchronous request. We will share this with you for your reference. The details are as follows:
1. jquery:
$ ("Html "). die (). live ("keydown", function (event) {if (event. keyCode = 13) {// here add the logic to be processed }});
2. jquery obtains multiple checkbox values:
$('input[type="checkbox"][name="types"]:checked').each(function() { types = types+$(this).val()+ "|"; });
3. jquery asynchronous request method:
$. Ajax ({url: "$ {pageContext. request. contextPath}/UOSRoleManangerAction. do? Method = createRole ", type:" post ", dataType:" html ", data: {" roleName ": roleName," roleDescription ": roleDescription," roles ": roles, "types": types}, success: function (data) {var dataObj = eval ("(" + data + ")"); if (dataObj. result) {alert ("operation successful! "); SubmitForm (null," initPage ");} else {alert (" operation failed! ");}}});
I hope this article will help you with jQuery programming.
Articles you may be interested in:
- Jquery directly submits the form operation code in response to the Enter key
- Keyboard Events of jQuery events (ctrl + Enter key submit form, etc)
- Code example for jQuery to implement Enter to switch the focus of a text box
- JQuery binds a click event when you press the Enter key.
- Implement the Enter switch focus based on Jquery
- Jquery implements full selection, reverse selection, and obtaining all selected checkboxes
- JQuery operation textarea, input, select, checkbox Method
- How does jquery obtain the values of multiple checkboxes and submit them to php asynchronously?
- Jquery ajax asynchronous request receiving returns a json data instance
- Jquery asynchronous request data instance code