Skip to content

Extends `$().ready()` to provide a convenient syntax for page-specific script

License

Notifications You must be signed in to change notification settings

vitalsource/jquery-readyselector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

With the Rails asset pipeline or other asset packagers, you usually include the JS for your entire application in one bundle, while individual scripts should be run only on certain pages.

jquery.readyselector extends .ready() to provide a nice syntax for page-specific script:

$('.posts.index').ready(function () {
  // ...
});

This works well if you include the controller name and action as <body> element classes, a la: http://postpostmodern.com/2009/02/20/a-body-with-class/

The callback will be run once for each matching element, with the usual 'this' context for a jQuery callback. $(fn), $(document).ready(fn), and $().ready(fn) behave as normal.

About

Extends `$().ready()` to provide a convenient syntax for page-specific script

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •