Category "javascript"

React Flow Chart: Connect link when drop anywhere on node

I have been using npm package react-flow-chart, I can now create links between nodes using drag and drop. The issue is: I have to drop the link exactly on the p

Play audio on image hover in HTML (multiple images)

This is my first attempt at audio in HTML. So I have a grid of images that have an overlay of text on them, and I want the audio to play a different sound on ho

Fatal error: Array and string offset access syntax with curly braces is no longer supported in php 8.0 pkcs5_unpad

I got this error after copying code from a tutorial. It's deprecated and I tried resolving it: Array and string offset access syntax with curly braces is no lo

How to detect browser close event or tab close event in angular 6+?

I have written @HostListener in my AppComponent Class to detect browser close or tab close. I have written this code but it is not working. Kindly help me unde

react-gtm-module appears to create an invalid src path?

It appears that react-gtm-module is creating the wrong src path. It is swapping a "/" with a ".". This is the src path as provided by Google. https://www.google

JSON.stringify on Arrays adding numeric keys for each array value

I am trying to convert an array to object . Below is the array value which I am trying to transform into an object. kbInfo : [{ "questionId": "1", "customQuesti

v-carousel is responsive but not the images it contains

When I use v-carousel, everything works fine, except I noticed on mobile even if the carousel itself is responsive, the images inside it are not, so only the mi

How can I get user id from session in javascript?

How can I get the user id from session in javascript? I was using this: $( document ).ready(function() { var sessionUserId = '<?php $_SESSION['user_id']

Vue 3: component not rendering when added with router-view

I have created vue app using vue-cli and instead of html I have added my component TopBar for links and those links are not getting rendered. App.vue <templa

How to identify whether website is accessed from same hosted server or different client machine

We have a website hosted in local intranet environment using Python webserver. In that website particular button should only be visible if user is accessing thi

Implicit return in a javascript class method

Suppose I have this code: class AuthService { loginWithEmailAndPassword(email, password) { return apolloClient.mutate({}); } } export default new AuthS

Is there a best practice for managing isLoading state?

I'm sorry for my English skills in advance. Let's say I want to fetch data from server and render it on page load...the logic is something like this: Page is lo

Can I send a database in a zip folder with mantaining the connection between the database and the php file

I want to send a folder that contains my HTML code, CSS, js and PHP. how can I include the database and keep the connection between my files and the database?

how to hide previous markers when new markers added in google map javascript api

I have set store locator using google map javascript api. when someone enter their location they will find the stores within the 50km of radius. I want when use

Nuxt auth user reset after browser refresh

i'm building an app with user login and register info. I use nuxt/auth module for handling the authentification. Whenever the user get logs in the state change

react-select debounced async call not displaying suggestions

I'm using react-select loading the results from an api and debouncing the queries with lodash.debounce: import React, {useState} from 'react'; import AsyncSele

Highcharts Issue in range selector buttonafter calling setExtremes in case of YTD button click

We have a highchart where we have implemented range selector , with buttons like 1d, 7d, 1m, 6m, 1y, YTD and ALL. In our case we have data starting from Jan 1,

Live reload is not possible without a body or a head tag

My program is to store the number of entries through the entry button and save it through the save button... So, I added a JS link in my HTML body tag and then

Getting req.headers is undefined when trying to read from req object in NextJS

On page load, I try to fire off an authentication request if a token exists in local storage. // utils.ts const init = async () => { try { const

local storage is not persistent in react app

I am creating a react app which is using local storage. I am saving and array of objects to local storage. when I try to save to local storage the data is savin