0

I have the following javascript object:

Note: I'm copying this from my browsers console

Object
content: "http://localhost/abito/website/secondary_imgs.php?imgId=18&imgTitle=Hugo%20Boss%20Sweat-Top%20-%20Skaz%20in%20Grey&mWidth=593&mHeight=900"
gallery: "New Arrivals"
link: HTMLAnchorElement
options: Object
player: "iframe"
title: "Hugo Boss Sweat-Top - Skaz in Grey(front)"
__proto__: Object

It is being created by the plugin Shadowbox.js, so I have no control over it's creation.

My question is, is there any way I can edit the content part of the Object, and then place it back in the Object?

The Object is already referenced to the variable c. I am able to reference the content with the following: var url = c.content. What I am unsure of is how to edit the content, and then place it back inside the object for use.

Thanks in advance for any help you can provide.

1
  • 2
    Just assign to it: c.content = (edited content here). Commented Sep 12, 2011 at 18:21

1 Answer 1

2

if c refers to the object, then you simply need to assign a different value to the properties you want to change, like this.

c.content = 'what you want';
c.gallery = 'new gallery';

etc. But I'm not sure what you will be able to achieve with this anyway, it all depends on how and when those values are being read.

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

2 Comments

I am placing the object c into the function Shadowbox.open(c) which works properly. I think that's what you are referring to. I will test this out. Thank you.
Then it's most surely used as a settings object to alter the behavior of the open method, it should work if you modify its content before calling the open method.

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.