0

I am trying to access object key. The key is shown in object in console but when I am trying to access that key its return undefined. fiddle

console.log(e) //object
console.log(e.data.$menu) // undefined
console.log(e.data.selector) // .context-menu-one

enter image description here

enter image description here

Jitender
  • 7,593
  • 30
  • 104
  • 210
  • I'm confused: in your third line, did you mean `console.log(e.data)` ? You have `console.log(e.data.$menu)` twice with two different outputs. – Mulan Jun 06 '15 at 20:05
  • Is your issue on IE ? from your fiddle: `// NOTE: this is the item that wraps in IE9 but not in Firefox` – Cyrbil Jun 06 '15 at 20:09
  • @naomik: Sorry that was my typo error, I have edit my question – Jitender Jun 06 '15 at 20:10
  • If it yields `undefined` *when* accessed, then that means it's `undefined` *at that time*. Where is `.$menu` populated? – Bergi Jun 06 '15 at 20:13
  • @CrayonViolent: it is still showing undefined – Jitender Jun 06 '15 at 20:16
  • @Bergi: i have printed whole object in console. $menu is showing up there and when I print 'selector' which is also part of that object is print successfully on console – Jitender Jun 06 '15 at 20:18
  • @amit: Please read the linked question I've closed yours as a duplicate of. Why the property is *not yet* populated when you log the object, we only can tell with insight in your code - please post it. – Bergi Jun 06 '15 at 20:21
  • @Bergi: I have attached fiddle – Jitender Jun 06 '15 at 20:31
  • @amit: Sorry I didn't notice, but the relevant code should go into the question anyway (please edit it in). And that fiddle you linked (http://stackoverflow.com/q/24662289/1048572) doesn't even contain the log statements you claim are not working? Did you paste the correct link? Or what do I need to do in that fiddle to reproduce your issue? – Bergi Jun 06 '15 at 20:37
  • @Bergi: I have updated the correct link – Jitender Jun 06 '15 at 20:42
  • @amit: OK, after I've fixed the syntax error in there I can confirm that the `build` callback is called *before* the menu element is created and assigned to that `.$menu` property. (See the duplicate for why it still shows up in the console). So what? Why did you expect to be able to access it, do the docs of that plugin mention it somewhere? What is your actual question? – Bergi Jun 06 '15 at 21:25

0 Answers0