Home > Web Front-end > JS Tutorial > body text

JQUERY form temporary storage function plug-in sharing_jquery

WBOY
Release: 2016-05-16 15:14:11
Original
1638 people have browsed it

jquery.formLocalStorage is a jquery plug-in that implements universal form temporary storage function

Principle:

Monitor changes in form fields, use localStorage in HTML5 WebStorage to store the values ​​of these changed form fields, and load the stored values ​​back into the form fields when the form is reloaded, thereby implementing the temporary storage function.

Features:

1. Do not use server-side storage to save server resources.

2. The code is concise. If you use the default configuration, you only need a short piece of code $("#your_form_id").formLocalStorage(); to get it done. There is no need to write a lot of server-side logic.

3. Rich configuration items and default values. Through the configuration items, you can customize the style of the temporary content, the callback events after the temporary storage is loaded, stored and deleted, as well as the temporary storage naming rules. You can also use Default values ​​thereby reducing excessive configuration work.

Usage:

1. Use default configuration:

$("#your_form_id").formLocalStorage();
Copy after login

2. Use custom configuration:

$("#your_form_id").formLocalStorage({
  storage_name_perfix : 'your_storage_name_perfix', //自定义暂存存储的命名前缀
  storage_events : 'click' //自定义暂存触发事件
});
Copy after login

Known issues:

1. Some contents dynamically written into form items cannot be monitored and cannot be temporarily saved.

2. The default storage_name_perfix is ​​this.context.URL + form_selector + "@". If this.context.URL changes after submission, the temporary storage will not be located. It is best to use another unique value as the default storage_name_perfix.

Plug-in download http://xiazai.jb51.net/201602/yuanma/jquery.formLocalStorage(jb51.net).zip

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!