Login plugin from for bootstrap.
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-
, as in data-type="dropdown"
.
Name | Attribute | Description | Default |
---|---|---|---|
- | data-toggle | Activate bootstrap login without writing JavaScript. | login |
lang | data-lang | The language of login form, support zh_CN or en . |
zh_CN |
title | data-title | The title of login form. | Bootstrap Login |
type | data-type | The type of login form, support normal or dropdown . |
normal |
action | data-action | The action of login form, use RESTful default. | '' |
onSubmit | - | Fires when submit the form. | function() { return false; } |
Activate bootstrap login without writing JavaScript. Set data-toggle="login" on a normal element.
<div data-toggle="login"></div>
<div data-toggle="login"
data-lang="en"
data-title="GitHub"
data-action="https://github.com/"></div>
<li data-toggle="login" data-type="dropdown" data-lang="en">
Call a bootstrap login with id table with JavaScript.
$(function() {
$('#login').bootstrapLogin();
// use submit
$('#login).bootstrapLogin({
onSubmit: function(username, password) {
if (username === 'admin' && password === 'admin') {
location.href = 'http://wenzhixin.net.cn';
return true;
}
return false;
}
});
});