npm.io
1.0.0 • Published 10 years ago

virgule

Licence
MIT
Version
1.0.0
Deps
0
Vulns
0
Weekly
0
Stars
1

Virgule

Virgule (vir•gule) is a Javascript plugin that do one thing, set focus on an input field (typically search input) using virgule (/) key.

Install

bower:

bower i virgule --save

npm:

npm i virgule --save

How to use

Given the markup

<input class="search" type="search">

<script src="virgule.js"></script>

Quick initialization

virgule.init('.search');

Virgule also accept a dom element so the code above can be written to

var input = document.querySelector('.search');
virgule.init(input);

Virgule also work well with browserify

var virgule = require('virgule');
virgure.init('.search');

Options

keycode
  • type: String
  • default: '191' (virgule keycode)
  • Description: which key's keycode used to set focus to the input
Browser support

Keywords