The standard ready function doesn't always work in WordPress plugins. Here's a workaround.
If you're properly enqueuing scripts and styles into your WordPress plugins and themes, you may have noticed this doesn't work:
$(document).ready(function () {
alert($(".container").length);
});
The solution, using jQuery, is this:
jQuery(document).ready(function ($) {
alert($(".container").length);
});
You have to pass the $
to the ready function before you can effectively use it.
The CoffeeScript equivalent to this is:
jQuery(document).ready ($) ->
alert $('.container').length;
Short, simple, but a frustration saver.