Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old June 30th, 2016, 05:39 AM
Registered User
Points: 5, Level: 1
Points: 5, Level: 1 Points: 5, Level: 1 Points: 5, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2016
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default data.js:14 Uncaught TypeError: Cannot read property 'id' of undefined

Hello programmers,
can somebody please help me out here ? what could be the cause of this error message:

Uncaught TypeError: Cannot read property 'id' of undefined

here is the code
var products = [
	{"id": 1, "name": 'Assassin Creed', "category": '', "price": 13.45, "quantity_in_stock": 5},
	{"id": 2, "name": 'Thunder', "category": '', "price": 15.45, "quantity_in_stock": 5},
	{"id": 3, "name": 'The Witcher', "category": '', "price": 18.45, "quantity_in_stock": 5},
	{"id": 4, "name": 'Red Hair', "category": '', "price": 21.45, "quantity_in_stock": 5},
	{"id": 5, "name": 'The brothers', "category": '', "price": 23.45, "quantity_in_stock": 5}

localStorage.products = JSON.stringify(products);
var proOBJ = JSON.parse(localStorage.products);
var productlist = document.getElementById("productList");
for (x = 0 ; x <= proOBJ.length ; x++) {
	var items = document.createElement("li");
	items.id = "product" + proOBJ[x].id ;
	items.classname  = "product"+ proOBJ[x].id ;
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
debug; says: this property is read-only, now eypril SQL Language 1 March 3rd, 2010 03:10 PM
Ajax Cart update Undefined Property modelreject BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 1 March 16th, 2009 10:04 AM
Loading JS in the same id place..PLZ HELP nospirit Java Basics 0 December 27th, 2005 07:44 AM
Read a property file Sindhu EJB 0 December 1st, 2005 05:47 AM

All times are GMT -4. The time now is 07:12 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.