Giter Site home page Giter Site logo

senbei's Introduction

Senbei

Introduction

Senbei is a jQuery plugin, which enables the browser to keep form controls' state of value or checked or selected, using localStorage, Cookie, or any other variable. Also, Senbei provides individual form controls with responsive functions.

Tutorial

Initialization

To experience Senbei easily and quickly, put the following in your application.

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
</head>
<body>
	<input type="checkbox" class="senbei" name="example" value="1" checked>
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
	<script src="jquery.senbei.js"></script>
</body>
</html>
var app = senbei({
	name: 'app',
	read: 'localStorage',
	write: 'localStorage',
});

Then, go to the page, uncheck the checkbox, unfocus the element, close the page, and visit again. If the checkbox is unchecked, Senbei works successfully.

Likewise, Senbei enables other types of control to hold the state. (e.g. <input type="text">, <input type="radio">, <select>, etc.) But don't forget to set the required attributions, class="senbei", name and value.

Attaching Senbei

To make Senbei work on specific elements, you should set the required attributions on the proper elements.

Examples

<input type="text" class="senbei" name="example-input-general" value="">
<input type="radio" class="senbei" name="example-input-radio" value="1" checked>
<input type="radio" class="senbei" name="example-input-radio" value="2">
<input type="radio" class="senbei" name="example-input-radio" value="3">
<select class="senbei" name="example-select">
	<options value="1">1</options>
	<options value="2">2</options>
	<options value="3" selected>3</options>
	<options value="4">4</options>
</select>

senbei's People

Contributors

knj avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.