views:

72

answers:

3

I have a function that looks like this:

jQuery.fn.menuFunc = function( settings ) {
        settings = jQuery.extend({ 
          actionAddURL:"",
          actionModifyURL:"",
          ........
          },settings);};

where all the parameters i initialize (actionAddURL, actionModifyURL, etc..) are strings (ids of different elements or urls). My question is how do i add some objects there. myObject:"" doesn't seem to be the way to do it. Any tips?

+1  A: 

Probably:

myObject: {}

is what you are looking for.

You can then add properties to it:

myObject.name = "Name";
kgiannakakis
A: 

To define an object you could use the following syntax:

myObject: { stringProp: 'value1', intProp: 10, arrayProp: [ 1, 2, 3 ] }
Darin Dimitrov
+1  A: 
myObject:[] // empty JavaScript object
,
myOtherObject: { // JavaScript object notation
       name: "Bob",
       age: 17
      }
Kobi
Problem solved thanks.
bogus