I am trying to write Javascript so that when one of these list items is selected by the user, the color changes red just for the selected item. The issue I am running into is that this selects all of the list items, instead of the one that is selected. Right now my Javascript looks like this: The HTML looks
How to Change links in node.js
i’ve been trying for a while to get the tabs on my navigation bar to change (including the link) when a user logs in. The whole thing is a problem on the index page, as you should enter it both logged …
get message between two user
i want to retrieve conversation between two user sorting by the newest with the user sender field my message and user schema : const messageSchema = new mongoose.Schema({ from:{ type: mongoose….
How to select a distant parent from a child (button element) nested deep inside a div?
I’m trying to select the form element which is the distant parent of a button. The button is deeply nested inside of a div. I have two type of forms in two pages so I’m using the same event for both of them. That’s why I’m using bother the selectors separated by a comma. What I tried s…
Not able to remove option in cloned select
I have an issue with removing a cloned option that I created. I can remove the original option, but nothing is removed from the clone. What is wrong with this code? I tried several methods but still failed. Thanks for helping me. Answer The issue is because you’re selecting the option elements. As such …
Create array of arrays from array of objects in the style of a matrix
I have an array of objects. I am trying to create a matrix-like array of objects. This is my code: let data = [ {device: ‘iphone’, site: ‘google’, val1:10, val2:20, val3:30}, {device: ‘…
Using filter to show all objects except the one I am clicking on
I am trying to setup a “remove from cart” button but I ran into some issues. I am having a hard time explaining what I mean, but I will do my best. So pretty much, my goal is to filter out the product from the cart that the user is clicking on, I am doing this by targeting the ID.
How to use event and variables in the same function
function edit(id) { let name = document.querySelector(‘#name’); let price = document.querySelector(‘#price’); name.value = products[id].name; price.value = products[id].price; …
Flappy bird code not working – JavaScript
I wanted to write a flappy bird game in javascript but it doesn’t seem to work when I open it in my browser. the css works. lines 147, 154, 31 and 160 in js all seem to be errors, but I do not understand how to fix them. this is my html: There are many errors in the js when
symbol/ how to split into two separate numbers
hi everyone so i’m solving the problem i have a script this is the result from the web 1/5 how to split into two separate numbers? the output is this how to do not let go if the number is greater …