Code Monkey home page Code Monkey logo

platekeyboard's Introduction

plateKeyboard jQuery H5 车牌输入组件

plateKeyboard是一个基于jQuery的移动端插件,支持5类颜色的车牌录入,自带车牌规则校验,调用时一行代码轻松搞定。

功能特点

  • 车牌中没有I和O,所以在键盘上永久禁用这两个按钮;
  • “收起”按键只有当车牌输入完整的情况下才会启用,否则处于禁用状态;
  • 点击指定车牌号码指定位置可以直接修改该位置的字符;
  • 车辆输入完整自动收起键盘;

设计规则

  • 蓝牌白字:共7位,第1位是省份简称,第2位是英文,其他位可以是英文或数字,没有特殊的汉字;
  • 黄牌黑字:共7位,第1位是省份简称,第2位是英文,最后一位可以是“学”或“挂”,其他位可以是英文或数字;
  • 白牌黑字:共7位,第1位是省份简称,第2位是英文,最后1位可以是“警”或“应急”,其他位可以是英文或数字;
  • 黑牌白字:共7位,第1位是省份简称或“使”,最后1位可以是“港”、“澳”或“领”,如果第1位是“使”则第2位和最后1位只可以是数字或字母;如果最后1位是“领”,则第一位只能是省份简称第2位只能是字母;其他位可以是英文或数字;
  • 绿牌黑字:共8位,第1位是省份简称,第2位是英文,其他位可以是英文或数字。

调用示例

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<link href="bensie.plateKeyboard.css?v=30" rel="stylesheet" />
<script src="bensie.plateKeyboard.js?v=30"></script>
<div id="kb" style="margin-top:30px;"></div>
<script>
    //初始化
    $(function () {
        bensie.plateKeyboard.init({ id: 'kb', plateColor:'蓝牌白字', plateNo:'粤XGM789' });
    });
    
    //演示获取录入的内容
    function showPlateColor() {//获取车牌颜色(如:蓝牌白字)
        var color = bensie.plateKeyboard.selectedData.plateColor();
        alert(color);
    }

    function showPlateNo() {//获取车牌号码
        var no = bensie.plateKeyboard.selectedData.plateNo();
        alert(no);
    }

</script>

效果演示

image image

image

platekeyboard's People

Contributors

devrecole avatar

Watchers

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.