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,646
questions
0
votes
0
answers
5
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.
<li class="hasChild"><a>Setup <i class=...
0
votes
0
answers
7
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
12
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
5
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
6
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
0
answers
18
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
19
views
Javascript: Any way to create a class by constructing class name using strings/variables dynamically without eval?
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 ...
1
vote
1
answer
11
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
6
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
32
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
%�...
-3
votes
0
answers
35
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
8
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
23
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>
<...
-1
votes
0
answers
10
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
11
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
43
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
11
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....
0
votes
1
answer
17
views
Can't use variable field of mongodb in javascript
I have retrieved one document from mongodb, in that I have one array and I want to loop through that array but I can't do that. If I loop through that it consider whole array as one element, this is ...
-3
votes
0
answers
26
views
Invalid Client or invalid client credentials [closed]
{
"error": "invalid_client",
"error_description": "Invalid client or Invalid client credentials"
}
I have put everything correct for the basic ...
1
vote
0
answers
10
views
e.nativeEvent.offsetX is 0 on mouseMove inside setState function
I have the following code that gets the cursor position on a canvas element. The code works fine in Chrome, but in Firefox, the e.nativeEvent.offsetX is 0 inside the set state function and outside is ...
0
votes
0
answers
7
views
WKWebView accessibility tree not updated after DOM change
I have a simple UIKit app that pushes a view containing a WKWebView. If VoiceOver is enabled, when the view is pushed the OS sets the accessibility focus in the back button of the navigation bar. The ...
0
votes
0
answers
13
views
Zod allow all keys matching regex
I'm using zod to validate some data, and I want to allow certain attributes, as well as any attribute with key matching /metadata_hash_.*/.
I cannot simply use a record because I am using mixed types, ...
0
votes
0
answers
11
views
How to debug scroll event fired a lot later than the pointermove event?
With Chrome's 20x slowdown + device emulation, you can see that the first scroll event occurs 230ms after the first mousemove event:
On Android (a flagship 2023 phone), without any artificial ...
0
votes
2
answers
40
views
How can I use concat to convert a dom NodeList to a array?
I found the statement [].concat(anotherArray) is not completely same to the [...anotherArray].Especially when we use it to convert NodeList.
I want to iterate a NodeList in Vue template, like this:
&...
-2
votes
0
answers
19
views
Why res.clearCookie() is not working after deploying to vercel?
First of all, everything works fine when running on localhost.
However, after deploying the app to Vercel when the user tries to log out it should clear cookies with res.clearCookie() but it doesn't ...
-2
votes
0
answers
20
views
Why "Favor composition over inheritance" and not "Favor aggreggation over inheritance"?
I have read many different articles on "Favor composition over inheritance" over the years and despite reading so many, actually finding clear concise code examples has been difficult.
I ...
-1
votes
0
answers
17
views
Generate editable PDF from html content having forms using angular
With below html content, using jspdf lib, i was able to generate pdf, but when i try to edit it(using adobe acrobat), it was unable to read this checkbox, it is rendered as image post conversion.
<...
0
votes
1
answer
16
views
Change the title and URL on the main page when clicking on a link in the iframe
I need your help, I have a parent A page with an integrated B iframe.
When I click on a link in the B iframe, I want to retrieve the title and url of the clicked link and pass it to the main page to ...
0
votes
0
answers
9
views
Parse aggregate pipeline to match objects with a valid pointer field
const query = new Parse.Query("TimeSpent");
const pipeline = [
{
$match: {
date: {
$gte: new Date(startDate),
$lte: new Date(endDate)
...
0
votes
3
answers
23
views
How can I store the response of my axios get request as json in node.js?
I'm trying to send a request to an api using axios and store the json response in a variable. When I output the response to the console, it shows it, but when setting a variable equal to it and ...