Code Monkey home page Code Monkey logo

apassword's Introduction

apassword


NPM version spm package Build Status Coverage Status

移动端密码控件。

snipshot


使用说明

  • maxlength 定义了密码长度,默认长度为 6。
  • 为了表单校验,建议同时设置 minlength
  • 可以通过 pattermtype 属性控制键盘响应。
<input type="password" class="apassword"
    pattern="\d*"
    minlength="6" maxlength="6" />
var APassword = require('apassword');

new APassword("input.apassword")
  .on("complete", function(value){

    alert(value);

}).render();
</script>

API

val()

获取密码。

clear()

清空密码。

focus()

让密码控件获得焦点,该行为会激活显示键盘。

blur()

让密码控件失去焦点,该行为会隐藏键盘。

Events

complete

指定位数的密码输入完成时,触发 complete 事件。

focus

密码控件活动焦点时触发 focus 事件。

blur

密码控件失去焦点时触发 blur 事件。

参考

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.