Category "javascript"

How do I use variable in a query selector - js?

What am I doing wrong? there are 7 pictures with pre-made IDs from "img1" to "img7" function changeWidth() { let b = 50 let k = 0

Unauthorized Error when I want to delete article with authentification (jwt)

I've created a route called login and another one function(middleware), if the authentication is good, this can be redirected to the delete route but unfortunat

how to pass outlet context to nested route in react router v6

I am using react router dom v6 how can I access the context in a nested route in the second child <Routes> <Route element={<Parent/>}>

How to convert city name to coordinates in JS?

Is there a way to convert city name into coordinates? Openweather api provides access to historical data but i need to have "lat" and "lon" coordinates instead

Do I need to check if a browser supports a certain event before adding the event listener

I was just curious I came across the following package Virtual Scroll. And in it when initializing they check for browser support before adding the event listen

Submit a text string plus file - edited

I am trying to submit a text string (downloadstr) and 1 second later to submit a file. I have to do this in plain JS/HTML (microcontroller webserver) I submit t

Vue3 v-for Maximum recursive updates exceeded in component <Carousel>

New to Vue and JS. I have a vue page myLists which takes an array of lists (containing media IDs for a title) which I used to make axios API calls and build a c

Electron Amplify AppSync "Realtime disabled when in a server-side environment"

I'm using amplify appsync in my electron app and all works except for the realtime events which means my app doesn't get signalled when the data changes in the

Using functions from imported modules in another file

Say I have file1.js and file2.js... file1.js: import React from 'react'; const test = ( {prop} ) => { function test1() { prop('1'); } fu

Vuejs types for component refs

I have following scenario: I have an component here: <div class="border shadow p-2"> <chart :config="barConfig" ref="linechart" /> </div>

Should I always return a promise when I have an async function?

When I write an async function it usually returns a promise: export const myPromiseFunction = async (params) => { // some logic return Promise.resolve('r

Take function from one file to another (React)

So I'm struggling to pass "polygonNFTs" to another file. I need to find its number to decide give user permission or not. its working in index but not in navbar

DOM .value attribute not working - returning blank string

For whatever reason, the .value attribute on the input boxes is not returning the values entered. When running it through the Number(), it returns 0, and withou

"Navigation is Blocked" message on Chrome 99 / Android devices

I am managing some payment pages now. Some online mall creates an Iframe and call our payment page. When I click button with Chrome 99 on Android devices, "Navi

App Script Array Push() in loop Optimization

I'm looking to improve my array push inside loops but I noticed that every time my function is being called (in a loop manner) and executing this lines of code,

How to override js method in Odoo 15?

Can anyone give me minimal code so that any method I can override for JS method? changeMode(mode) { if (!this.hasPriceControlRights && mode ===

Javascript works in codepen but not on browser

const toggleButton = document.getElementsByClassName('navbar-toggle')[0]; const navbarLinks = document.getElementsByClassName('navbar-links'); toggleButton.

React useCallback() not working as expected

I'm trying to understand useCallback() a bit better by creating a simple React app and playing around with it. I tried wrapping handleClick function in useCallb

Take full screenshot in Chrome

I developed a little chrome extension, which takes a screenshot from the current page. The Problem is, when a part of the current area is covered by e.g. the in

React Native update component

I'm pretty new to react-native. When I click the stop sleep or info button I send patch requests to the users.json file to change the status. My JSON file conta