I am trying to submit a form using Remix’s useSubmit hook. But I want to be able to pass arbitrary data along with my form submit data. I have form elements with some static values that have disabled/readonly attributes, which means their value will be null on form submission. However I have access to t…
useState is not re-rendering with push and pop on an array state
I’m attempting to update the usersData variable created using useState so that anytime someone clicks on add user, a data object is added to the beginning of usersData, but the problem is that it only works with spread operators and not with push, pop, or unshift operations, as seen in the code below. T…
Vertical to horizontal to vertical again scroll effect
I want to make a vertical to horizontal back to vertical scrolling effect that also works on mobile. I have found the following jQuery code snippet: But it doesn’t work very well on mobile, which is a deal breaker for me. I am looking for something more like these two examples: https://www.ls.graphics/d…
I want to change the image I am using whenever the product is added to cart
I am using this right now, need to add a condition in such a way that whenever the getCartCount is 0 it should show image as bag_empty instead of bag and when the cart count is more than 0 it should show bag Answer You could use a ternary operator like below, assuming that you have your empty bag image
On hover of slick text is hidden due to non responsive css how to make it responsive?
I am not getting the on-hover dates but it is rendered to the page on inspecting I suspect it may be due to the responsive problem of CSS, or class breakage. How to resolve? CSS code: JS code DIV Answer This is due to the relative position of the hover. Reducing the relative position and reducing the font siz…
How to call push() function from firebase database
I’m trying to get a unique key from the push function but whenever I call it I get this error: Uncaught TypeError: postsRef.push is not a function at HTMLFormElement. These are my imports: And these are the lines that I use to call the push function: I hope you guys can help me, thank you Answer push is…
How to use JavaScript to apply slidedown functionality in accordion?
In this snippet below, I’m trying to apply a slide down functionality to each panel when opened. The result is that slide down is working. The problem is… In mobile, when a second panel is opened, the first panel remains at full height. Slide up functionality isn’t working as expected. Lastl…
Why my image slider only show the first image instead of all 3 images?
I want to make an image slider in my application using the ‘react-simple-image-slider ‘ package. But it only show the first image only.. In my firestore, my imageUrl is stored like this: In the documentation of the package, it shows that the ‘images’ should be stored in this format: Th…
Jest command not recognized
So i just started learning about Test Driven Developement and as an example i was asked to run the command npm test helloWorld.spec.js in the terminal but i got this error : I’m working on windows and the only thing i have installed is node so what do i have to do? Answer Choose one of the following met…
ele = document.querySelector(el) for multiple instances of el
I have a swipe detection function detectswipe(el, func) that listens for data-animate=”swipe” and runs the function swipe(el, d) when swiped on mobile. The problem is it only runs on the first instance of data-animate=”swipe” and not every instance. How do I change my code to run on ev…