Note: I will only accept pure js answers, not jquery or any other js library. I have a onchange method attached to a selector We get the element’s value which in this case could be of two options: is-room-type-false and is-room-type-true. These classes are attached to every single table on the page (the…
Category: Questions
Confusion with hiding some input fields using JS vanilla
I want to show hidden input fields when check “Buy on company” checkbox. It works, but if I uncheck it leaving “Is VAT exemt” checked and return: “VAT ID field” is shown with “Is VAT exemt” checkbox checked. So I want to avoid this situation. Picture of situatio…
onClick of button triggering all the components to open – Reactjs
I implemented a Card component and basically generating a bunch of cards on some input data. I binded a setter function on button click on every card which basically expands and collapse it. Even after putting unique keys to the div is sort of triggering all the cards to open at once. Here is the code piece: …
Accessing error from react-hook-form using reactstrap
I created a form with reactstrap and react-hook-form. Why are my errors not displaying? Dummy section which renders text input: Text input with error: Submit Button Thanks. Code Sandbox Answer @jamfie, you are using different useForm for each component. Your form need to have the same instance, you can do tha…
How can you change a CSS value when a JS value reaches a certain value?
So, I’m making a web game, where the site gets mad at you. I’ve completed the anger level internal coding, and I’m currently working on implementing a color-changing feature when the anger level reaches a certain value. I want it to change a few tints redder when the anger level reaches an i…
Is there a .contains method in javascript that works similar to Python’s implimentation .__contains__()? – node.js
I’m wondering if there is any implimentation of a object.contains method in javascript that works similar to how the Python version object.__contains__() works, as in I want to be able to scan the whole object with nested objects to see if there is either a key or a value that does contain what the meth…
destructuring props in component getting different result
New to react world, trying to learn destructuring, have been reading about it but stuck here, if i do it like this function MList({action}) { // const data = [action];} i am just getting ‘cameras’. So how to destructure and get same result as with props below this is Mcard.js: This is inside MList…
vuejs search filter with 2 v-for
I have the following filter computed export default { data() { return { columns:{}, search:””, trovato:{}, }; }, …
Escaping ” or ‘ multiple times
So I often have to generate content for webpages through servlets or jsps. In that process I sometimes run into a problem when trying to escape multiple layers of ” or ‘ when working with strings. For example I’m creating an element with a popup here: I cannot use the alternative ‘ bec…
Mongoose error: “Topology was destroyed”, what’s the problem?
I was coding a leveling system for my discord bot, but encountered a mongoerror on the way, does anyone know why this is occuring? (The addXp function runs whenever someone chatted, the error is logged in the removeTimeout function.) I have used mongoose in many more ways in my code but this hasn’t yet …