I want to toggle a Boolean field value in Firebase 9. I’m using Vue 3 If the value of isFav is true I want to make it false onclick If the value of isFav is false I want to make it true onclick It works fine when I set the value of isFav to just false or true. But setting
Category: Questions
How would I select a group of buttons using classes and if any of them are pressed, a alert pops up
I tried using .addEventListener with querySelector, but for some reason it wouldn’t work. The error is Uncaught TypeError: Cannot read properties of null (reading ‘addEventListener’) I don’t understand why the error is happening either. Anyone have some knowledge they can share? ……
How to get the rect.top and rect.left of an element if it’s mapped in React JS
I am trying to have a gloss effect on some cards when the mouse moves over them. What I need is to move the gloss effect base on the mouse position. The problem that I have is that I can’t get the top and left of the card because they are mapped like this I have tried to use the
React router v6: Protected Routes displaying after logging out
I am attempting to implement a private route in React; the homepage should not be visible until the user logs in. If I restart my frontend, all protected routes are not accessible until the user logs in. However, after the first login, all protected routes don’t seem to be protected; I can logout, the s…
Jquery ajax usage for object
I was trying to complete project on fcc.Didn’t know how to add quotes in html.Looked up in their premade project found this piece.Can someone explain what is going on in this code? Answer It’s a hack to get around an incorrect Content-Type. gist.githubusercontent.com isn’t designed to host J…
How to download multiple files from firebase using downloadURL in javascript?
I have this code: but instead of downloading the files it opens them in my browser. The currCart[index] is just the wanted name of the downloaded file. Any suggestions? Answer To download a file, we need to create a Cloud Storage reference to the file we want to download, to do that, you can create a referenc…
How do you delete every line inside of a string that doesn’t contain a specific word?
There’s a string with multiple lines of random characters, I’d like to delete every line that doesn’t contain the word :tesTWORD: For example, this part of the original string Would turn into this: So basically all lines that don’t contain the exact word :tesTWORD: get deleted. I have …
How to detect if the script is trying to add the two same IDs?
I’m trying to make a logger for IDs and names, but I can’t seem to detect if the script is trying to add the two same IDs. I’ve tried id.includes(user._id), but it always passed the if test. Here’s the code: Answer You can search your id array with find this will give you the current o…
Modifying attributes and texts that follow simple patterns
Here is my initial unuseful code. I would like that the browser works with the following code for the body where [[ … ]] has been cut, and {{ SOMETHING }} is become <span style = “color: red;; font-weight: bold;”>SOMETHING</span>. I have no control on the DOM structure, and the p…
Generate random letters “H” and “V” n times
I have a really specific problem and can’t think of an answer. I have a function to generate a letter H or V. I want to make that if the generator exceedes the limit for H to pick V and if the limit for V gets exceeded to pick H. Example Limit for H is 10 Limit for V is