0

I have an Array of objects and need to add new object as per some criteria. As consist list of objects as:

enter image description here

How to create new object which have all above properties and add to end of array using jquery?

0

2 Answers 2

1

You can use the push() method of the array to do this:

// assuming 'arr' is the variable containing the array you showed in the question:
arr.push({
    AgentOnlyFieldFlag: 'False',
    // other properties here...
});

More info on push()

Also note that you should really change the AgentOnlyFieldFlag, BlankCaptionFlag and PromatchFlag to contain boolean values instead of strings.

Sign up to request clarification or add additional context in comments.

Comments

0

1.you can create a plain object in jquery

Ex:

var foo = { foo: "bar", hello: "world" };

refer : http://api.jquery.com/jquery/

2.you can create array in jquery

Ex:

var array = new Array();

  1. push elements into an array

Ex: array.push(foo);

refer : https://www.sitepoint.com/declare-arrays-jquery/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.