Jquery captures the Enter key and obtains the checkbox value and the asynchronous request method,

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.