I have the following code, which I am following from the jQuery documentation on how to build a plugin.
I'm just trying to create a simple isNot extension:
(function ($) {
$.fn.isNot = function (selector) {
return !this.is(selector);
};
})(jQuery);
$(document).ready(function () {
$("#someButton").click(function (event) {
alert($("#someCheckbox").isNot(":checked"));
});
});
When I run this the javascript file get's loaded properly, and I can step through the code in firebug. I see that jQuery is defined properly, and the click event gets wired up properly, too.
However, I have added a watch in FireBug to track the isNot function, and it is always null. I can't get it to ever become defined.
Is there something I'm not doing properly?