brevity.js is a javascript plugin for wrapping registered abbreviations in abbr
tags.
This automates the repetitive task of supplying abbr
tags for accessibility.
Abbreviations are registered on initialization and are completely customizable.
Once you have included the javascript in your page, you can initialize the plugin by calling the brevity()
function.
The function takes two arguments:
brevity()
function once the content is ready either via window.onLoad
or $(document).ready
(if you're using jQuery).
The abbreviation array defines all abbreviations you want registered with the plugin. Each item in the array is an object that should contain the following two properties:
Property | Description |
---|---|
abbr | The abbreviation string the plugin will search for and will wrap in abbr tags |
title | The expanded text for the abbreviation that will be used in the title attribute of the abbr tag |
As a second, optional, parameter brevity takes an options object. The following options can be set:
Property | Type | Description |
---|---|---|
root | DOM Node | The root node from which to begin parsing for abbreviations. Only nodes within the root node will be converted to abbr tags |