jquery.behavior: chunk up your jQuery into 'behaviors'

If you’ve written more than a trivial amount of jQuery, you quickly wonder about the best way to organize your JavaScript. @rodpetrovic’s take is called jquery.behavior:

// 1. Create behavior:
function BadBehavior(element, config) {
  this.misbehave = function () {
    alert('Oh behave!');

// 2. Attach behavior:

// 3. Use behavior:
$('.bad-behavior').behavior('misbehave'); // alert('Oh behave!')

[Source on GitHub] [Homepage]

News Films

Our little film studio focuses on telling developer-centric stories that need to be seen.

GopherCon 2016 Conference Recap

0:00 / 0:00