Skip to content

Image src won’t change using JavaScript

I feel like I have this right, but for some reason, the addEventListener isn’t functioning how I want it to. When I try to change the img.src below, it still only shows the ‘images/expand.jpeg’ img. I have confirmed that the path to the image is correct, as it does show the ‘images/col…

Set variable to method

I want to make a shorthand library for myself, ex: shortening querySelector to get. would there be a way to return just the method without document? EXAMPLE: Thanks. Answer You have to call .querySelector on either the document or an element. It can’t be left off. While you could pass it into the functi…

Targeting textual data to a DIV on a web page?

I have a web page – index.html on a localhost webserver – split horizontally via DIV elements and a CSS stylesheet into upper / lower panes. Titles (hyperlinked to source HTML documents) appear in the upper split. Task 1. When I click a hyperlinked title, the output is targeted to a DIV on index.h…

Issues with conditional rendering react

So I have read quite a lot about react conditional rendering on the official docs and on STO as well but I have some issues and doubts. My objective here is I’m trying to check if the value of {game.embed_url} is NULL then no <iframe> should be rendered, else <iframe> should be rendered, Ofc…

Javascript – Stuck in an if statement – Beginner Question

I am trying to make a calculator, simply my problem is this: Page refreshes. User clicks on any number and the number gets added to the First Number: nums_clicked h1. If user clicks on an operator sign(+ – *), the clicked boolean becomes true. If clicked is true, add the numbers clicked to the Second Nu…

Spread Operator – TypeScript

I’m trying to pass an array as an argument with Spread operator but something is going wrong. Answer For TypeScript to correctly predict what argument types are going to spread into the parameter, you will have to change the args variable type into a tuple as follows:

Puppeteer , bringing back blank array

I’m trying to grab products from ebay and open them on amazon. So far, I have them being searched on amazon but I’m struggling with getting the products selected from the search results. Currently its outputting a blank array and im not sure why. Have tested in a separate script without the grabTi…