Questions tagged [javascript]
For questions about programming in ECMAScript (JavaScript/JS) and its different dialects/implementations (except for ActionScript). Note that JavaScript is NOT Java. Include all tags that are relevant to your question: e.g., [node.js], [jQuery], [JSON], [ReactJS], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript
2,532,676
questions
0
votes
0
answers
8
views
Row Span logic for ag grid
I have an ag grid with row spanning and I am able to do row span for first and second column. Can anyone please help me for row span logic for rest of the columns (notes, votes)?
Here is the ...
0
votes
0
answers
10
views
Webpack: How do I replace <use> tag with actual svg data?
My index.html uses a svg in this way:
<button class="button--settings" id="button_settings">
<svg role="img">
<use href="assets/images/...
0
votes
0
answers
17
views
How can the input value be enclosed in a variable?
I'm trying to create a component that will have an input and a button. In input, the user enters his nickname. This nickname, that is, the input value, must be stored in a variable. This variable is ...
0
votes
0
answers
14
views
Why is my horizontal rule element not visible in the tooltip?
How can I customize the tooltip to my liking? Nothing I try seems to work.
formatter: function() {
let total = 0;
let tooltipHtml = `<strong>${this.x}</strong><br/>`;
...
0
votes
0
answers
6
views
VS code extension - Gutter icons
I am currently using codelens inorder to click and proceed to action , How do I add gutter icon with quick pick menu to show actions , Thanks
The set/get decoration endpoint doesnt seem to be working ...
0
votes
0
answers
13
views
How to fetch data for Client Components on server-side
When I say Client Components -> I mean files that uses use client at the top of it, and Server Components — files that are using use server accordingly
Nobody says, how to fetch data on the server ...
0
votes
0
answers
13
views
How can I get the width of my horizontal bar graph with chart.js?
I made a chart with the library chart.js, and next to the chart are the data numbers, so if I have a chart with the data of 150, it will display 150 next to the horizontal chart, but that number isn't ...
0
votes
0
answers
10
views
How to generate openapi doc in express
I'm making a REST service using javascript and express. I have some endpoints and I wanna create a swagger file to serve along with it. I'm using swagger-autogen to generate the swagger file. Even ...
0
votes
0
answers
13
views
element plus key How do I set the key for select v2
How do I set the key for select v2 to prevent the entire visual list from being refreshed during virtual scrolling and reuse the dom using vue's diff algorithm
<template>
<el-select-v2
...
0
votes
0
answers
10
views
Data resolution are not changing when try to minimize the resolution
In Firefox browser, when opened in normal form all data moves towards right, while it appears correctly in Chrome and Edge. Also when I tried to minimize the resolution in edge or chrome all data ...
0
votes
2
answers
9
views
Htmx on custom events
I'm trying to use htmx triggers and custom events without success. I'm using custom events because I'm going to trigger multiple refresh in a page. My source is very simple, but I cannot make it work:
...
0
votes
1
answer
14
views
require not defined error while deploy vite-react app
While deploying a vite-react app in Netlify I am getting white screen and require not defined error.
I tried removing "type":"module" from packag.json file.enter image description ...
0
votes
0
answers
12
views
Does Date object in browser update timezone correctly after changing system timezone frequently on Ubuntu?
I am encountering an issue where the browser timezone information becomes incorrect after changing the system timezone multiple times on my Ubuntu PC. Specifically, the Date object in my browser ...
0
votes
0
answers
28
views
Cancel function
I have a component on the search page, and inside the component, there is a useEffect that triggers the post filtering and fetching code from the database when the search words (city, word in post, ...
-1
votes
2
answers
29
views
Is there a way to select all elements of class ("btn") whose parents are of class ("seat") using javaScript and change it's background color?
I am trying to implement a bus seat layout. I want seats to change it's background color when clicked. The seats are bootstrap radio buttons with class='seat' and labels with class='btn'.
I have tried ...
0
votes
2
answers
29
views
Unable to add request-header to POST request [duplicate]
I am hitting the API by using payload and in headers giving Content-Type : 'application/json' still in browser in request headers I'm seeing Content-Type : 'text/plain'
Because of that in the backend ...
1
vote
0
answers
21
views
Detecting CSS @scope support with JavaScript
Is there a way to detect @scope support via JavaScript?
I've tried: CSS.supports('@scope') or CSS.supports(':scope') but both of those are returning false in browsers that do support it.
I tried CSS....
0
votes
1
answer
22
views
Display an Alert When User Session Expires in Laravel
I am using the Laravel framework and would like to create an alert when the session expires. I tried implementing a JavaScript code that checks if the user is logged in every three seconds as follows:
...
0
votes
0
answers
30
views
Html not loaded even after window.addEventListener('load', do_something) is invoked
I'm working on a browser extension that scrapes data from a webpage. I've added a method to scrape data, which is invoked via a load listener:
window.addEventListener('load', scrapeSomething)
However, ...
0
votes
0
answers
5
views
Jest - react-native-color-matrix-image-filters/dist/CMIFColorMatrixImageFilterNativeComponent.js: Could not find component config for native component
I have a React Native Android project and I just upgraded the react-native version from 0.72.3 to 0.74.3. After a fair amount of library upgrading, TS and Lint fixes, etc I was able to get my ...
-2
votes
0
answers
20
views
Stripe Connect Payouts API
I am creating an application in which users can add their bank accounts in the application and from admin side I want to send the payouts to their bank accounts. I am using Node.js and Stripe.js (In ...
-1
votes
0
answers
8
views
req.headers.authorization is undefined
So I've been trying to implement JWT authorization for my project, and there's this specific step that I've been stuck for hours... So I have a middleware setup to try and verify the access token ...
-1
votes
0
answers
12
views
Create custom img collage from uploaded photos [closed]
I wan to build custom image layout, where you upload image and the end result is collage. I dont really know where to start.
My idea is to create pre-defined grid, and to each square you can upload ...
-1
votes
0
answers
13
views
Combine arrays on update to Dynamo table - Cannot read properties of undefined (reading '0')
I have a DynamoDB table that is holding several pieces of data, of which one will be an array of objects.
I have a lambda that will handle another array of objects coming in that I am wanting to ...
-3
votes
0
answers
12
views
NO_RESULTS return from directionsService.route() [closed]
I'm currently using Google's Directions API, and I stumbled upon an issue.
For some reason, a lot of my calls to directionsService.route() to receive the duration of the itinerary seem to return ...
0
votes
0
answers
8
views
@iFrame-resizer/react implementation error - Uncaught SyntaxError: Unexpected token 's', "scroll-to-top" is not valid JSON
I am using the latest version of iframe-resizer/react for automatically adjusting the height and width of the iframe.
Whenever I'm reacting the content, I'm getting a runtime error stating -
VM2860:1 ...
0
votes
1
answer
23
views
The input in searchbar disappears when i click on any other space/part of the browser of when i click tab button
import React, { useState, useEffect, useRef } from "react";
import { useNavigate } from "react-router-dom";
import axios from "axios";
import Autocomplete from "@mui/...
0
votes
0
answers
18
views
TypeError: Cannot read properties of undefined (reading 'quantity')
Ecommerce site using MERN. This is the Navbar.jsx component. Error shows cant read undefined 'quantity' on line 72.
ERROR MESSAGE
Uncaught TypeError: Cannot read properties of undefined (reading '...
0
votes
0
answers
9
views
Getting the Editor Content based on the Cursor Position in a Vs Code Extension
1Are there some available ways for getting the entire function based on the current cursor position in the Vs code Editor ,
For Eg. Refer This Image here my cursor is at a line inside the function , ...
-1
votes
0
answers
13
views
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax,
This is the error i am getting:
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such ...
-2
votes
0
answers
21
views
I can't display values from a javascript function separately through an array or a callback function [duplicate]
I need to retrieve the latitude and longitude coordinates to use them elsewhere. What is the easiest way? Using an Array? Or an callback function?
According to the code snippet below, the console.log(...
0
votes
0
answers
15
views
scrollTo specified position when entering page
When entering the page, I use window.scrollTo to scroll to a specified position, but it seems that the browser will scroll the page back to the top?
In a Vue3 project, I used window.scroll({top: 200, ...
0
votes
0
answers
26
views
How to use event.target.closest for navbar html javascript css?
I'm making a navbar. On click of items which has subnav pages, the navigation item/expands or collapses.
Here's the HTML/JS/CSS snippet.
const navHasChilds = document.getElementsByClassName("...
0
votes
0
answers
11
views
Request the user's phone number directly through the Telegram WebApp
I want to request the user's phone number directly through the Telegram WebApp.
I created this code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-...
-1
votes
1
answer
11
views
MQTT describe function outside the handler
I am working on MQTT
https://www.emqx.com/en/blog/mqtt-js-tutorial#mqtt-js-api-introduction
This is how i connect.
const client = mqtt.connect(host, optionsMQTT);
client.on('connect', function (...
-1
votes
1
answer
23
views
How to define a variable of exported type in React?
I have defined a custom structure in a separate file:
//status.js
export const status = [
{
id:0,
label:"In progress",
},
{
id:1,
label:"...
0
votes
0
answers
8
views
Lightningchart JS - Chart is not interactable
I have 5 different line charts being rendered in my React app. Below is one of the methods to create those charts.
function createEcgHeartRateChart(
response: any,
startInterval: string,
...
0
votes
0
answers
10
views
How to Implement onPause and onResume using mediarecorder api in javascript
I am currently developing a Chrome extension that records the tab, but I am having difficulty implementing the onpause and onresume feature with the Javascript MediaRecorder API.
I'm calling pause() ...
0
votes
1
answer
45
views
I get the error that there is nothing available
I get the following error in the project I developed using React and Typescript.
export 'useTableProps' (reexported as 'useTableProps') was not found in './useTable' (possible exports: useTable)
It ...
0
votes
0
answers
30
views
Javascript: Any way to create a class by constructing class name using strings/variables dynamically without eval? [duplicate]
I've tried myriads of ways to create new class instances dynamically, without using eval and hard coded key-value pairs, to no avail. Seemingly there is no way in modern Javascript to query the user ...
3
votes
1
answer
19
views
Fix for AMP Error caused by the Imply script tag in nextjs App
Tag found outside the document head which is only allowed as a direct child of the document head.
Error:
Invalid attribute: data-amp-bind
Fix:
Ensure that you are using only allowed attributes for AMP ...
0
votes
0
answers
8
views
still giving error after using the use client on top in next.js component
× You're importing a component that needs useRouter. It only works in a Client Component but none of its parents are marked with "use client", so they're Server Components by default.
"...
-1
votes
1
answer
48
views
How to convert this raw pdf to pdf file
I have an api call which returns raw pdf. I'm storing them in a variable called rawpdf. I want to display that in my webpage. As shown here is the raw pdf file
//axios function retrned data
%PDF-1.4
%�...
-4
votes
1
answer
52
views
JS promises will run parallelly or one by one
Need to now about the promises , The JS promises will run parallelly or not
this is the below code I'm using, Here I am creating three promises and checking the execution time
const startTime=Date....
0
votes
0
answers
9
views
How to Close ISWebCombo Dropdown After Selecting a Value with AutoPostback Enabled?
I'm using an ISWebCombo dropdown control in my ASP.NET Web Forms application. The dropdown does not close automatically when I select a value. I need it to close after selection.
<ISWebCombo:...
0
votes
0
answers
27
views
Inserting unique attribute to HML tag element in loop
I have a supersite that uses all kinds of js, including backbone.js and underscore.js. On one of of my pages, I have the piece of code below:
<#loop:main_tlds_price_add#>
<tr>
<...
-2
votes
1
answer
15
views
Multiple markers in a loop in the Google-Maps API (JS)
I try to put multiple markers (the new 2024 API) with a loop, on Google Maps, but only the last is shown.
My code :
let map;
async function initMap(center, pk, partner) {
const ...
0
votes
0
answers
16
views
Static import of JSON object specifying the type
I have a small javascript web-application that I develop on my laptop and is later bundled with webpack for publishing.
In some files, some JSON-data is imported right in the "header" of the ...
1
vote
3
answers
54
views
Skip arguments in JS [duplicate]
I have a function example(arg1,arg2,arg3,arg4) and the function uses arg4 for something. Is there a way for me to skip the other arguments instead of having them as unused variables.
I tried example(,,...
-1
votes
0
answers
14
views
Screenshotting of SVG D3 diagram with wrong rounding edges
I'm trying to take a screenshot of SVG of my Sankey diagram generated by D3.js in React app. Every time I try to capture it using different libraries and methods, the edges of the links become rounded....