Skip to content

Commit

Permalink
Added syntax highlighting
Browse files Browse the repository at this point in the history
  • Loading branch information
markijbema committed Jun 5, 2014
1 parent 4dbba5c commit c6d8584
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,31 @@ This plugin is based off of the plugin by Tzury Bar Yochay: [jQuery.hotkeys](htt

The syntax is as follows:

$(expression).bind(types, keys, handler);
$(expression).unbind(types, handler);

$(document).bind('keydown', 'ctrl+a', fn);

// e.g. replace '$' sign with 'EUR'
$('input.foo').bind('keyup', '$', function(){
this.value = this.value.replace('$', 'EUR');
});

```javascript
$(expression).bind(types, keys, handler);
$(expression).unbind(types, handler);

$(document).bind('keydown', 'ctrl+a', fn);

// e.g. replace '$' sign with 'EUR'
$('input.foo').bind('keyup', '$', function(){
this.value = this.value.replace('$', 'EUR');
});
```

Syntax when wanting to use jQuery's `on()`/`off` methods:

$(expression).on(types, null, keys, handler);
$(expression).off(types, handler);

$(document).on('keydown', null, 'ctrl+a', fn);

// e.g. replace '$' sign with 'EUR'
$('input.foo').on('keyup', null, '$', function(){
this.value = this.value.replace('$', 'EUR');
});
```javascript
$(expression).on(types, null, keys, handler);
$(expression).off(types, handler);

$(document).on('keydown', null, 'ctrl+a', fn);

// e.g. replace '$' sign with 'EUR'
$('input.foo').on('keyup', null, '$', function(){
this.value = this.value.replace('$', 'EUR');
});
```

## Example

Expand Down

0 comments on commit c6d8584

Please sign in to comment.