zepto.js-form Methods

Source: Internet
Author: User

Load module: form.js

Serialize

Serialize () ⇒string

Compiles the value of the form element used as a submission into a URL-encoded string in an AJAX POST request. Serializearray

Serializearray () ⇒array

Compiles the value of the form element used as a submission into an array that has a name and value object. Cannot use form elements, buttons, unchecked radio Buttons/checkboxs will be skipped. The result does not contain data for file inputs.

$(‘form‘).serializeArray()//=> [{ name: ‘size‘, value: ‘micro‘ },//    { name: ‘name‘, value: ‘Zepto‘ }]
Submit

Submit () ⇒self Submit (function (e) {...}) ⇒self

Bind a handler function for the "submit" event, or trigger the "submit" event on the element. When there is no given function parameter, the current form "Submit" event is triggered and the default commit form behavior is executed, unless Preventdefault () is called.

When given a function parameter, it is simple to bind a handler function for its "submit" event on the current element.

// 触发当前表单“submit”事件,并且执行默认的提交表单行为$("#btn").on(‘click‘, function () { // 触发当前表单“submit”事件,并且执行默认的提交表单行为 $(‘form‘).submit();});
$(‘form‘).submit(function (e) {    // 表单验证等操作... if (true) { return false; }});

zepto.js-form Methods

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.