views:

312

answers:

1

I'm using the following as a basis for a jquery plugin but I seem to have some syntax issues from my .find onwards. The code within the click function won't get called and the class is not being applied. Can someone suggest where I may have gone wrong here please?

(function($){

        $.fn.expandCollapse = function(options){

    var opts = $.extend({}, $.fn.expandCollapse.defaults, options);

    function initialize(){

    $(this).each(function(){
     // code
    }).find("p").click(function(){
     // code
    }).end().not(:first).addClass(opts.c);
     }
   initialize();

   return $(this);

        };

        $.fn.expandCollapse.defaults = {
   c: "collapsed"
        };

})(jQuery);

+2  A: 

You have this snippet:

not(:first)

Try wrapping ':first' in quotes.

Ron DeVera
Thanks Ron. That's cleared up the syntax errors, but for some reason nothing within the .click()(function(){ is being called. Is my syntax there correct? There are definately s to find.