From c6d85847db70a11dc8fde3d51ff0ed4b7d9025b8 Mon Sep 17 00:00:00 2001 From: Mark IJbema Date: Thu, 5 Jun 2014 10:44:17 +0200 Subject: [PATCH] Added syntax highlighting --- README.md | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index fd1d6b4..6b5ba45 100644 --- a/README.md +++ b/README.md @@ -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