Question
HTML, JavaScript I'm having trouble getting my objects to show up. If you have a webpage and with single button on the webpage centered on
HTML, JavaScript
I'm having trouble getting my objects to show up. If you have a webpage and with single button on the webpage centered on the site , when you click the button, all the items in your array of objects list, (including the picture correlated to it) shows up in a div below it. This means no items in the array show up unless the button is pressed. Use a loop and innerHTML to do this.
For example given
var arrayOfObjects = [
{id: "1", name: "obj1", age: 100, price:"$1.00", picture:"object1.jpg"},
{id: "2", name: "obj2", age: 200, price:"$2.00", picture:"object1.jpg"},
{id: "3", name: "obj3", age: 300, price:"$3.00", picture:"object1.jpg"},
Please help and provide comments so I can understand. It should look like this..
.
Click me to display Javascript Objects! Click me to display Javascript Objects! Name: Apricots Price: $2.99 Name: Coconuts Price: $3.45 Name: Cherries Price: $5.75
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started