jQuery plugin .fn question

Posted by user319342 on Stack Overflow See other posts from Stack Overflow or by user319342
Published on 2010-04-20T00:12:51Z Indexed on 2010/04/20 0:23 UTC
Read the original article Hit count: 312

Filed under:
|

Hello,

I seem to be having some problems creating a jquery plugin. I am testing a simple plugin in firebug console and the function is not being defined as I would expect. Here is the code pattern I am using

jQuery.fn.test = function () {console.log("runs")}

I am trying to call the function with this call which is not working.

$.test()

But this call does

$.fn.test()

I don't think this is how it is supposed to work so I think I am doing something wrong, although all the documentation seems to agree that I should be correct. Any one have any advice?

Thanks, Cory

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-plugins