The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Programming Fundamentals" Dec 02 - 2:00 PM Eastern

Problem with jQuery plugin defualt options

  • # January 31, 2013 at 8:59 am

    I’m using the jQuery plugin template from [CSS-Tricks]( “CSS-Tricks”), but I’m having a problem with the default options.

    (function ($) {
    $.lilRWDMenu = function (el, options) {
    var base = this;
    base.$el = $(el);
    base.el = el;
    base.$“lilRWDMenu”, base);
    $.lilRWDMenu.defaultOptions = {
    mainMenuClass: ‘main-menu’,
    rwdMenuClass: ‘rwd-mobile-menu’
    base.init = function () {
    base.options = $.extend({}, $.lilRWDMenu.defaultOptions, options);
    $.fn.lilRWDMenu = function (options) {
    return this.each(function () {

    var mainMenuObj = options.mainMenuClass,
    rwdmenuObj = options.rwdMenuClass;
    console.log(mainMenuObj );

    For some reason the default options are coming back as ‘undefined’.

    I can’t figure out why it’s not working, so if anyone can check my code for me that’ll be great.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed