A simple jQuery on screen keyboard.
- Easy Setup
- Switch layout on the Fly
- Supports multiple input fields
- Custom layout
- First, copy and paste
lib/js/keyboard.js
in your project, and link to it before the closing</body>
element. Make sure jquery is linked before this. - Next, you'll need to copy and paste the plugin's css into your project. Both Scss and Css are included for flexibility and modifications.
- Lastly, link to the keyboard css file
jkeyboard.css
file before the closing</head>
element.
Note: This plugin requires your website or application already runs a copy of jQuery, version 1.10.1 or higher.
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="jkeyboard.js"></script>
<link rel="stylesheet" href="jkeyboard.css">
The first thing you will require is a keyboard holder that will hold the keyboard, and an input field on which the keyboard will operate.
<input type="text" id="search_field">
<div id="keyboard"></div>
$('#keyboard').jkeyboard({
input: $('#search_field')
});
To configure custom options when you initialize jKeyboard, simply pass an object in your call to jkeyboard:
$('keyboard').jkeyboard({
input: $('#search_field),
layout: 'english'
});
Option | type | Default | values | Description |
---|---|---|---|---|
customLayouts |
object | {selectable:[]} |
selectable, customLayoutName |
All the custom layouts as well as custom selectable layouts are defined in this object. |
customLayouts.selectable |
array | [] |
array of selectable custom layouts. If you have more than one custom layout, you can choose which layout to show in the layout switch. | |
customLayouts.layoutname |
an array of keys for keyboards | [] |
You can add as many custom layouts as you wish in the format of customLayouts.layoutName. Ex. russian: [Click to view in action |
Method | type | values | Description |
---|---|---|---|
init |
object | layout input customLayouts |
All the custom layouts as well as custom selectable layouts are defined in this object. |
setLayout |
string | azeri english russian numeric numbers_only symbolic *custom layout names* |