SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict tlacaelelrl's Avatar
    Join Date
    Apr 2011
    Location
    Mexico city, Mexico
    Posts
    353
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    append to object

    How can I append values to an object, if I have this:

    Code JavaScript:
    var fields_array = new Object();
     
    function somefunction(){
            fields_array.fieldset = groupname;
    	fields_array.fieldsetname = groupnamelegend;
    	fields_array.field = newfield;
    }

    I cant figure out how to add multiple values so I have something like
    Code JavaScript:
    //index 1 of object
    fields_array.fieldset = 'somevalue';
    fields_array.fieldsetname = 'somevalue';
    fields_array.field = 'somevalue';
    //index 2 of object
    fields_array.fieldset = 'somevalue';
    fields_array.fieldsetname = 'somevalue';
    fields_array.field = 'somevalue';
    //etc

  2. #2
    SitePoint Addict tlacaelelrl's Avatar
    Join Date
    Apr 2011
    Location
    Mexico city, Mexico
    Posts
    353
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I have created an array of arrays to overcome my problem, if you have any better ideas for me please let me know.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •