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.
2,524,586
questions
-3
votes
0
answers
16
views
How to change a variable in an object? [duplicate]
I would like to change the "stat" variable in both of these objects in a loop without doing it manually (I have a larger object than this.)
var obj = {obj1: {stat: 1}, obj2: {stat:1}};
to
...
0
votes
0
answers
12
views
Syntax error: SyntaxError: Unexpected token '.' line: 8 file: Code.gs
I don't understand what I did wrong here
Syntax error: SyntaxError: Unexpected token '.' line: 8 file: Code.gs
I was working on google docs script editor
I tried removing and adding the dot back but ...
0
votes
1
answer
24
views
Finding the 3rd point of a scalene triangle, with 2 points and a degree?
I have an unfinished triangle, what I know are:
coords for point A
coords for point B
length of AB
I'm trying to place a temporary point, on the same Y axis of B based on a given degree that will ...
0
votes
0
answers
13
views
JavaScript Flipbook - Div content not selectable
I'm working on a Flipbook based on this tutorial https://www.youtube.com/watch?v=0kD6ff2J3BQ
It uses papers, each paper has two sides (front and back). Basically when the next button is pressed it ...
-2
votes
0
answers
20
views
can someone help me with the JS code for the HTML one i created? [closed]
''Currently studying for a test i got in a few days, where we have to create a code for the site that is given to us in the picture.I managed to finish the HTML and CSS codes, but been struggling with ...
0
votes
0
answers
10
views
Proptype error when using Requireable<NonNullable<string...>
Type 'Requireable<NonNullable<string | ((...args: any[]) => any) | null | undefined>>' is not assignable to type 'Validator<"auto" | "above" | "below" | ...
-1
votes
0
answers
11
views
i am using javascript animation, although animation is added to element it does not display as it should
Please help me twice now i have tried to use animation in javascript using Element.style.animation = "shake 0.5s ease"; but it is not working even though in the console the animation is ...
0
votes
0
answers
8
views
Swiper Angular Pagination issue with Virtual Scroll
I have a feed like feature inside Angular and I am using swiper to show the images for each product, I am also using the cdk virtual scroll of angular.
This is how it roughly looks like:
<cdk-...
0
votes
0
answers
19
views
Permissions policy violation in Chrome-based browsers while accessing camera
I'm encountering a permissions policy violation issue specific to Chrome-based browsers when attempting to access the camera using the following code. Strangely, the code works without any errors in ...
0
votes
1
answer
16
views
Get metadata of storage file firebase
I have a firebase storage.
I have a function that lists all the files in that storage.
I download anything that doesn't exist locally, which is fine.
I want to get the metadata, particularly 'last ...
0
votes
0
answers
15
views
Can You Create A Persistent Floating Window in JavaScript?
I am trying to implement a persistent floating window in a NextJS 14 app. Basically this window should persist and stay on top, even if you navigate between browser windows. If you minimize your ...
-2
votes
0
answers
21
views
Maps with react native [closed]
how can I achieve this with React Native?
When I click on the paperPlane icon, a map should open, allowing the user to choose a location. A
fter selecting a location, it should appear in this box.
I'm ...
0
votes
0
answers
8
views
Unable to Automatically Update Leaflet.js Map when Table Data Changes in Filamentphp
I'm using Filament to build the user interface for my Laravel application, and I'm facing an issue with automatically updating a Leaflet.js map when the table data changes.
I'm using a Filament widget ...
0
votes
0
answers
8
views
react error All imports in import declaration are unused
please can I get some help with this code I do not understand why it is not using the imported elements. The error I am getting is All imports in import declaration are unused. I understand what this ...
0
votes
0
answers
12
views
How to merge all the subpaths in an SVG contained within a single <path> tag?
I'm using a bitmap tracer (Potrace) to try to generate an SVG of the outline of the bitmap. The problem is Potrace generates a filled shape. If I remove the fill and keep the stroke I'm left with two ...
0
votes
0
answers
13
views
How to conditionally render 3 different lists in React?
As you can see from the code, at first I want all the todos to be shown, then toggle between all, active and completed todos. I have made the arrays for the active and completed todos, but I'm not ...
0
votes
0
answers
10
views
Stripe Custom payment Flow returning Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
I'm following this guide: https://stripe.com/docs/payments/quickstart
I keep getting the error "Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')" after viewing ...
0
votes
0
answers
18
views
When install tailwind, styles from vite and css file still apply even though they are deleted
I installed tailwind and other tools using npm install -D tailwindcss postcss autoprefixer vite as tailwind doc says
Configure tailwind.config.js
export default {
content: [
"./index.html&...
0
votes
2
answers
30
views
How do I get these arrays to be equal to each other?
I'm cleaning up a game of tic-tac-toe I made a while back because I'm bored but I ran into a problem. The items are different because whenever I use .push or .splice on them it adds "" ...
0
votes
0
answers
13
views
Can I remove event.persist() if the event is not used in the handler?
Someone else wrote a React UI with several event handlers beginning with event.persist(). If I understand correctly the persist() function, it is needed to prevent React from recycling the event ...
1
vote
1
answer
36
views
Is there a direct way to deeply nest in a JavaScript object? [duplicate]
In other words: can JavaScript automatically create object parents?
In an example where "testObject" is already created...
let testObject = {}
...this throws an error...
testObject.parent....
1
vote
0
answers
34
views
New FormData(SomeForm) Not Calling Custom Getter in JavaScript
I have a custom dropdown componant. Within this component, I set a custom getter and setter shown below:
Object.defineProperty(this.DropDownInputTarget, 'value', {
get: function() {
return ...
0
votes
0
answers
19
views
How can I POST data to api controller by ajax in mvc?
I want to POST a string data to api controller in mvc by ajax , but its does not go to api controller!
this is what i tried
this is my js code:
jQuery(function () {
$(function () {
...
0
votes
1
answer
10
views
Sharing Global Constants/Variables in Astro
I have an Astro site that I'm working on, and I find that I'll be reusing constant values across all of my pages, for instance, a link to a social media account like https://x.com/someuser. This value ...
-1
votes
0
answers
18
views
Uncaught ReferenceError: submit button is not defined at createEventListener [closed]
I'm trying to code a function that opens a confirmation window when a user clicks a button. It doesn't work when I click the button. Whenever I inspect the code, it says "Uncaught ReferenceError: ...
0
votes
2
answers
39
views
Is there a way to have a webpage work as a background to a cursor? [closed]
I'm new to working in web development and I was trying to build a project. Basically, the project would enable the user to see a preview of a webpage if they were to hover their cursor over a link. I ...
0
votes
0
answers
10
views
ChartJS changing border of one element in a horizontal stacked bar chart
This is for version 4 of ChartJS. I have a scenario where I want to allow users to click on one element in a horizontal stacked bar chart and have that element's border be changed such that the user ...
-3
votes
0
answers
27
views
How to add an edit functionality in a todo list project using vanilla javascript
I really need some help with my todo list project. everything is fine but I can't seem to make the edit feature work on my todos, I finally knew to some extent how to change the desired todo title, ...
-1
votes
0
answers
12
views
CastError author
im working on a MEAN stack project , i have a user can post an article on after getting logged on.
in page of user login ; i can make dynamic name by post with {{author.name}} and get his image (+...
0
votes
0
answers
15
views
How to read and manipulate files with html/javascript [duplicate]
I'm trying to make a page on my site which allows input of a number of .JSON files, to further combine them into one JSON file. The combined data of which is manipulated and displayed to the user ...
0
votes
0
answers
8
views
Vuelidate dynamically adding a field to array immediately makes it dirty
I am working on a vue 3 app with vuelidate next and have some validations that look like this:
validations: {
currentUser: {
name: {
required,
maxLength: maxLength(...
0
votes
0
answers
29
views
Playing audio object when state changes
How can I trigger playing audio correctly on constant state change in React?:
const [previousItem, setPreviousItem] = useState()
useEffect(() => {
if (myArray ? .size > 0) {
const item = ...
0
votes
0
answers
18
views
TypeError: scroll.on is not a function
So I'm trying to make my image go bigger as I scroll down my page. I use NextJS and locomotive-scroll To do this I try to access the progress of my image but I get that error message
Unhandled Runtime ...
0
votes
0
answers
16
views
Im getting this error: Uncaught Type Error: Cannot set properties of null [duplicate]
Here is the HTML
<div id = "calculator">
<input id = "display" readonly>
<div id = "keys">
<button onclick="...
0
votes
0
answers
32
views
Why is my WebRTC only working over my local network
So I am setting up WebRTC for the first time and got it working fine on my local network, but when I tried over another network it just stopped working. I have setup a stun server and a turn server ...
0
votes
0
answers
19
views
Datatable (Edit Button) doesn't work on second page
I currently have a table which populates data from my server. However, on the second page and further, the "edit" button no longer works. This issue only happens when I link my table to the ...
0
votes
0
answers
7
views
After loading the Expo go project it becomes a white screen. (expo-splash-screen)
After loading the expo-splash-screen, a white screen appears.
App.js
import React, { useCallback, useEffect } from 'react';
import * as Font from 'expo-font';
import { useState } from 'react';
import *...
0
votes
0
answers
13
views
React JS Access GeoLocation variables outside of async function
I am trying get my current coordinates and then pass them to a function to calculate the distance, I know I am in a async method but I cannot reference the other function within it. How can I return ...
-1
votes
1
answer
61
views
Try Catch block in javascript for fuctions that already use try catch
I have this function in Javascript:
async function getData(url) {
try {
const response = await axios.get(url);
return response.data;
} catch (error) {
console.error(...
0
votes
0
answers
17
views
Model.json file not loading properly
I'm trying to deploy my custom model on a webapp. I want the user to be able to upload a picture and see the results of my model's predictions. I keep getting an model not loaded properly error. I don'...
0
votes
0
answers
9
views
Supabase array column includes any element of another array
I'm trying to filter my supabase blogposts depending on if they have a tag that is included in the current post tags. Basically, i want a 'related' posts component.
The blog has a tags column (an ...
0
votes
0
answers
9
views
How can I make an expo-av video restart onPress?
I am building a quiz that randomizes 20 items from a data array. Each quiz question plays a video with a judo technique and the player tries to identify the technique shown. Once an answer is clicked ...
1
vote
0
answers
11
views
Slider label not updating with javascript value change
I am building a tool that uses sliders for inputting values, which are then used in a calculation. I recently implemented a feature that allows users to save the model they created, which they access ...
-1
votes
0
answers
4
views
Node.js library or module for downloading files from SharePoint using JavaScript or TypeScript (not SPPull)
I’m currently developing an app in SAP Fiori to download files from a private SharePoint site. I tried using the SPPull library, but it doesn’t align with Fiori standards and throws an error related ...
0
votes
0
answers
24
views
Adding navigation buttons to modal
Ive already made my sign in modal, however im trying to add buttons to the top, one button navigating to register/sign up, and the other button leading to the sign in modal, as represented by the ...
0
votes
0
answers
25
views
Setting active-class to work across multiple independent v-lists in vue 3
I'm unable to make navigation selections using active-classes to work properly across multiple independent navigation v-list items in Vue 3.
Here is a reference to the navigation setup:
V-List 1: Item ...
0
votes
1
answer
21
views
scroll method in javascript is not working
scroll method not working but ı can use style.left and get it done. How can i use the scroll method and get the same result ?
HTML:
<div class="wrapper">
<div id="prev&...
1
vote
1
answer
94
views
How can i make my snake movement not delayed
i am making a snake game, by myself but i ran into a problem when i pressed my keys my interval pauses for a major time, i dont want it to pause i want it to continue going on
const trackMovement = ...
0
votes
0
answers
10
views
JavaScript touch event listeners on iOS do not register quick swipes
Im implementing simple swipe events with touchstartandtouchend its working fine on Androis but on IOS 13, 14, 15 it`s registering swipes only if you make them slow. Here is my js code maybe you can ...
0
votes
1
answer
20
views
Error: cannot find module. any suggestions?
i am trying to make and use a local module using node js. i have written all code taking help by angela yu's course and it is giving me a cannot find module error. this is code written in my date.js ...