Skip to content

Introducing jQuery.whiny.js

We’ve all done something like this:

$('#id').text('new text');

And wondered why the code wasn’t working only to find out the selector was wrong. jQuery.whiny.js attempts to solve this problem by altering the jQuery library so the jQuery() method will create a console warning if an empty jQuery object returned.

In the above example, if ‘#id’ returned an empty jQuery object you’d see the following console warning:

jQuery was called with a selector of '#id' and returned an empty object

Please note, this is only for dev purposes. To get the jQuery.whiny.js, head over to the github project. Additionally, the name of this script was inspired by “whiny nil” from Ruby on Rails.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*