Write jquery at will

Source: Internet
Author: User

I have not used some of the knowledge points on the Web page before. It is easy to write it down and use it later. If it is not tested, it is simply taken online.Come;
: Hidden

Match all the invisible elements. If the type attribute of the input element is "hidden", it will also be matched

$ ("TR: hidden ")
Returns an array <element>

<Tr style = "display: none"> <TD> </tr>, <tr style = "display: none "> <TD> </tr>

 

======================================

Returns true or false if jquery is (exp ).

For example:
<Form> <input type = "checkbox"/> </form>

If ($ ("input [type = 'checkbox']"). Parent (). Is ("form ")){

// Xxxxxxxxxxxxxxx

}

======================================

 

 

Ajaxsubmit:
Ajax will submit the form immediately. You can submit this item under any circumstances.

= "{

Target: indicates the elements on the page that are updated by the server response. The element value may be specified as a jquery selector string, A jquery object, or a DOM element. Default Value: null.

URL: Specify the URL of the submitted form data. Default Value: The action attribute value of the form.

Type: method used to submit the form data: "Get" or "Post ". Default Value: The method property value of the form (if not found, the default value is "get ").
Datatype: data type to be returned. Null, XML, script, or JSON. Datatype provides a method that specifies how to process server responses. This is directly reflected in the jquery. httpdata method. The following values are supported:

'XML': If datatype =
'Xml' will treat the server response as XML. If the "success" Callback method is specified,
Returns the responsexml value.

'JSON': If datatype = 'json ',
The server response will be evaluated and passed to the "success" Callback method if it is specified.

'Script': If datatype
= 'Script'. The server response value is plain text.
Default Value: NULL (responsetext value returned by the server)

Beforesubmit: the callback function called before the form is submitted. The "beforesubmit" callback function is provided as a hook to run the pre-commit logic or verify the form data. If
If the "beforesubmit" callback function returns false, the form will not be submitted. The "beforesubmit" callback function has three call parameters: form data in array format,
Jquery form object and options object passed in ajaxform/ajaxsubmit. The form array accepts the following data:

[{Name: 'username', value: 'jresig'}, {Name: 'Password', value: 'secret'}]
Success: the callback function called after the form is successfully submitted. If the "success" callback function is provided, it is called when the slave server returns a response. The value of the datatype option determines whether to return the value of responsetext or responsexml. Default Value: NULL

The resetform Boolean flag indicates whether to reset the form if it is submitted successfully. Default Value: NULL
The clearform Boolean flag indicates whether to clear the form data if the form is submitted successfully.
Default Value: NULL

}

Example:

 

$ ("# Form1"). ajaxsubmit ({
Beforesubmit: function (formdata, jqform, options ){
// Hide the upload button
$ (". Upfiles"). Hide ();
// Display the loading Image
$ ("# Idprocess"). Show ();
},
Success: showresponse,
Error: function (data, status, e ){
Alert ("Upload Failed, error message:" + E );
$ (". Upfiles"). Show ();
$ ("# Idprocess"). Hide ();
},
URL: "http://www.cnblogs.com/Tools/xxxx.ashx ",
Type: "Post ",
Datatype: "JSON ",
Timeout: 60000
});

 

Related Article

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.