Skip to content

hdpe/jquery-behaviours

Repository files navigation

jquery-behaviours

Build Status

Simple jQuery plugin for behaviour attaching. For when you don't have anything like the need for a full-blown front-end framework à la Angular or React.

// register
$.fn.behaviours.register('.selector', function() {
  $(this).click(function() {
    // blah
  });
});
// on page load
$(function() {
  $(document).behaviours();
});
// reapply on DOM change
$(function() {
  $('.selector').load('/fragment.html').complete(function() {
    $(this).behaviours();
  });
});
// to hell with <script> tag order
$.fn.behaviours.register('.selector', function() {
  // blah
}, $.fn.behaviours.MAX_PRIORITY);

etc.

About

Simple jQuery plugin for behaviour attaching

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published