`
thinktothings
  • 浏览: 777622 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Form Plugin API

阅读更多

 

Form Plugin API

http://www.malsup.com/jquery/form/#api

 

 

 

Form Plugin API

The Form Plugin API provides several methods that allow you to easily manage form data and form submission.

ajaxForm
Prepares a form to be submitted via AJAX by adding all of the necessary event listeners. It does not submit the form. Use ajaxForm in your document's ready function to prepare your form(s) for AJAX submission. ajaxForm takes zero or one argument. The single argument can be either a callback function or an Options Object.
Chainable: Yes.

Note: You can pass any of the standard $.ajax options to ajaxForm

Example:

$('#myFormId').ajaxForm();
ajaxSubmit
Immediately submits the form via AJAX. In the most common use case this is invoked in response to the user clicking a submit button on the form. ajaxSubmit takes zero or one argument. The single argument can be either a callback function or an Options Object.
Chainable: Yes.

Note: You can pass any of the standard $.ajax options to ajaxSubmit

Example:

// attach handler to form's submit event 
$('#myFormId').submit(function() { 
    // submit the form 
    $(this).ajaxSubmit(); 
    // return false to prevent normal browser submit and page navigation 
    return false; 
});
formSerialize
Serializes the form into a query string. This method will return a string in the format: name1=value1&name2=value2
Chainable: No, this method returns a String.

Example:

var queryString = $('#myFormId').formSerialize(); 
 
// the data could now be submitted using $.get, $.post, $.ajax, etc 
$.post('myscript.php', queryString); 
        
fieldSerialize
Serializes field elements into a query string. This is handy when you need to serialize only part of a form. This method will return a string in the format: name1=value1&name2=value2
Chainable: No, this method returns a String.

Example:

var queryString = $('#myFormId .specialFields').fieldSerialize();
fieldValue
Returns the value(s) of the element(s) in the matched set in an array. As of version .91, this method always returns an array. If no valid value can be determined the array will be empty, otherwise it will contain one or more values.
Chainable: No, this method returns an array.

Example:

// get the value of the password input 
var value = $('#myFormId :password').fieldValue(); 
alert('The password is: ' + value[0]); 
resetForm
Resets the form to its original state by invoking the form element's native DOM method.
Chainable: Yes.

Example:

$('#myFormId').resetForm();
clearForm
Clears the form elements. This method emptys all of the text inputs, password inputs and textarea elements, clears the selection in any select elements, and unchecks all radio and checkbox inputs.
Chainable: Yes.
$('#myFormId').clearForm();
clearFields
Clears field elements. This is handy when you need to clear only a part of the form.
Chainable: Yes.
$('#myFormId .specialFields').clearFields();
分享到:
评论

相关推荐

    form-generator-plugin-1.0.3.zip

    "form-generator-plugin-1.0.3.zip" 是一个压缩包文件,其中包含了一个基于Vue.js和Element-UI的表单设计器。Vue.js是目前非常流行的前端JavaScript框架,以其轻量级、易学易用以及组件化开发模式而受到开发者们的...

    jQuery form插件之formDdata参数校验表单及验证后提交

    Form Plugin API 里提供了很多有用的方法可以让你轻松的处理表单里的数据和表单的提交过程,通过本文给大家介绍jQuery form插件之formDdata参数校验表单及验证后提交的相关知识,感兴趣的朋友一起学习吧

    jQuery.form.js

    总结起来,jQuery Form Plugin 3.51.0版本是一个强大的工具,它通过提供丰富的API和事件,帮助开发者高效地处理HTML表单,实现异步提交、文件上传和数据验证等功能,大大提升了Web应用的交互性和用户体验。...

    ajaxForm异步提交表单(含图片)

    AjaxForm是jQuery Form Plugin的一个功能,用于实现异步表单提交,特别是处理包含图片在内的复杂数据。本文将深入探讨如何使用ajaxForm进行异步表单提交。 首先,让我们了解什么是Ajax。AJAX(Asynchronous ...

    jquery.form.js

    《jQuery Form Plugin:简化异步表单提交与文件上传》 在Web开发中,jQuery库以其简洁的API和强大的功能深受开发者喜爱。其中,`jquery.form.js`是jQuery的一个重要插件,它扩展了jQuery的核心功能,使得表单的异步...

    jquery.form提交方式

    jQuery提供了一些验证插件,如jQuery Validation Plugin(https://jqueryvalidation.org/),可以方便地集成到表单提交流程中。 总结,jQuery为表单提交提供了丰富的API和插件,让开发者能够灵活控制提交行为,实现...

    user-form-plugin

    "user-form-plugin"这个标题暗示了我们正在讨论的是一款专注于用户表单处理的插件,它可能包含了丰富的功能,如数据输入验证、表单自定义、数据存储等。接下来,我们将深入探讨用户表格插件在PHP环境中的应用与开发...

    java-jquery-form.rar

    jQuery Form Plugin是jQuery的一个扩展,它使得异步表单提交变得简单,支持多种提交方式,如AJAX、上传文件、定时提交等。"jquery-form.js"包含了这些功能的实现代码,开发者可以通过引入这个文件轻松地为表单添加...

    jquery form ajax 插件

    1. 插件介绍:jQuery Form Plugin是由Malsup开发的一款插件,它扩展了jQuery的功能,允许我们轻松地使用AJAX方式处理表单提交,实现无刷新的数据交互。这个插件不仅支持GET和POST提交,还支持文件上传,是前端开发中...

    jquery.formwizard-3.0.5

    在 `README.md` 文件中,通常会包含关于如何安装、配置和使用这个插件的详细指南,包括基本用法、API文档、示例代码以及可能的注意事项。`changelog.txt` 文件则记录了插件的更新历史,包括每个版本的新功能、改进和...

    jqueryapi12.离线版API

    jQuery拥有丰富的插件生态系统,如jQuery UI提供了一系列的用户界面组件,而jQuery Form Plugin则简化了表单提交和文件上传的处理。1.2版本虽然较旧,但仍有许多插件与其兼容,扩展了其功能。 七、性能优化 理解...

    structs api

    - 掌握struts-config.xml的配置语法,包括ActionMapping、Form Beans、Forward、PlugIn等元素。 - 学习如何使用Struts标签库来简化JSP页面的编写。 - 熟悉ActionForm的数据绑定和验证机制。 - 理解Dispatcher的工作...

    JQuery API

    jQuery拥有丰富的插件生态系统,如jQuery UI提供各种用户界面组件,而Bootstrap和jQuery Form Plugin等则扩展了其功能。这些插件通常通过`$.fn.extend()`添加到jQuery对象上。 ### 7. 版本迭代 随着前端技术的发展...

    jQueryAPI-100214.rar

    jQuery的插件生态极其丰富,如jQuery UI提供了一整套用户界面组件,而jQuery Form Plugin则简化了表单提交和处理。100214版本可能包含了这些插件的更新和优化。 总结,jQuery API 100214版提供了全面且易用的...

    Eclipse Form开发实例代码

    `org.eclipse.databinding`包提供了相关的API,可以提高代码的可维护性和减少重复代码。 6. **国际化**:Eclipse插件支持多语言环境,开发者可以通过`org.eclipse.ui.forms.IFormText`等接口实现界面文本的国际化。...

    Jquery(Validate-Form)使用方法[张振华.Jack]

    - **使用方法**:通过 jQuery 的 `.ajax()` 方法或者使用专门的插件如 jQuery Form Plugin 来实现。 - **参考资料**:可以参考官方文档或者社区内的相关教程来深入了解 Jquery Form 的用法。 #### 十、总结 本文...

Global site tag (gtag.js) - Google Analytics