Questions tagged [javascript]

JavaScript (not to be confused with Java) is a high-level, dynamic, multi-paradigm, object-oriented, prototype-based, weakly-typed, and interpreted language used for both client-side and server-side scripting. Its primary use is in the rendering and manipulation of web pages. Use this tag for questions regarding ECMAScript and its various dialects/implementations (excluding ActionScript and Google-Apps-Script).

Filter by
Sorted by
Tagged with
1
vote
0answers
8 views

delete image preview before upload

I am uploading multiple images and showing preview, it is working fine. When I want to delete a particular preview image the preview image is deleted but when I upload all the files are uploading. ...
-3
votes
0answers
7 views

Why does innerHTML not react to a .innerHTML JS function? [closed]

I'm attempting to make navigational tabs using buttons and JS functions, and the tab part seems to be working great. However, the content that's supposed to change when you click the tab won't change. ...
0
votes
0answers
7 views

How to use ngModel in the radio group from the api in angular

here's the code. list.component.html <div nz-row *ngFor="let remark of checklist"> <div nz-col nzXXl="12" *ngFor="let task of remark.tasks" style="padding: .5rem;"> ...
0
votes
0answers
5 views

How do I add css class names to text blocks in Squarespace?

I need to add a class name or an ID to a Squarespace textblock to be targeted by JavaScript. If I use a code block to add the text, I can add a class name, however it can't be edited easily like other ...
0
votes
0answers
7 views

await page.waitFor inside page.evaluate in puppeteer?

I was wondering if you could do something like page.evaluate((page) => { //Code to execute before await page.waitFor(1000); //Code to execute after the 1000ms time delay }, page); ...
0
votes
0answers
10 views

React : How to make password characters visible when typing each character and hide(*) after few time interval in react?

I want my password field behavior as shown in this image I found few solutions using jQuery and tried to convert it to react but It does not behave same with react as there is a setState which delays ...
0
votes
3answers
44 views

Only first element of the array is taken

i have searched of this issue on the internet but i dont find anything similar. i have an array in php. i passed this array to javascript function to check and disable checkboxes if their values are ...
0
votes
0answers
6 views

Unable to monitor blob requests or fetch blob URLs in Chrome extension

In my Chrome extensions, I need to monitor/fetch requests to blob: URLs. When I open the Chrome Developer Tools, specifically the Network section. I can see those requests a GET requests. However, ...
-1
votes
0answers
17 views

Buggy Variable JQuery

Below is some code that I have been working on. For some reason console.log(arrayOfSelection[i] + ': loaded fully!'); sometimes states undefined: loadedfully! rather than what is in the array. The ...
0
votes
0answers
9 views

How to get web midi to play midi controller connected to Logic?

So I have a midi controller connected to my machine, and I have it playing successfully with Logic Pro X on a mac. I'm trying with Web Midi API to send a note to this midi controller, as an output ...
0
votes
0answers
13 views

Intelsense not work properly , when i press ctrl + space in visual code it just show loading

enter image description here it happens when I run this uninstall -g create-react-app and install create-react-app with NPX, I tried uninstalling and install again but it's still same for me, is ...
0
votes
0answers
7 views

SVG image with gaussianBlur flickering around the edges in Firefox latest

codepen: https://codepen.io/cryptodescriptor/full/QWLrKMx github: https://cryptodescriptor.github.io/survey-form/ github repository: https://github.com/cryptodescriptor/survey-form Frosted Panel (...
0
votes
0answers
19 views

Why does `this.now = require(“performance-now”)` and `this.now()` not work well as a standalone JS file using Node.js?

I am attempting to write some code that works in most browsers and inside of the Node environment: if (!this.window) this.now = require("performance-now") function getNow() { return this.window ?...
-1
votes
0answers
28 views

JavaScript - big-O performance algorithm

Here is a simple algorithm exercise. My answer is correct. My doubt is about the big-O performance. Because in the problem statement it was writting this way: Write a solution that only iterates over ...
0
votes
1answer
18 views

How to automate a JS script to keeping repeating a instruction?

My goal is to make a script click continuously on this two button without need to call it manually, my script have the ability to click on the button, but I don't know how to automate the action, ...
0
votes
0answers
7 views

Dropzone delete not working on server side success

I have integrated dropzone library with laravel .Dropzone set following configuration autoProcessQueue: true, uploadMultiple: true, parallelUploads: 10, maxFiles: 10, paramName: "photos", ...
-1
votes
0answers
17 views

Combining Arrays Using forEach Method Causing Errors

I'm using the eBay Api to update values for items i have stored in a database, which is shown with favorites array below. On my Favorites page, i'm displaying a user's favorite items. I also have ...
0
votes
0answers
11 views

Click event not working with webcomponent

I am trying to add a click event with my web component element. but not works. jscode: class HelloWorld extends HTMLElement { shadowObject; constructor() { super(); this.shadowObject = ...
0
votes
2answers
21 views

Dynamically update a buttons onclick inside a Bootstrap Modal

I'm trying to pass a value into a Bootstrap Modal and then display it when a button is clicked, however nothing is displaying when I click the button.. Can anyone help fix the issue? I believe the ...
0
votes
0answers
15 views

How Can I Avoid “tainted by cross-origin data” on My OWN PERSONAL, locally stored, image files?

I am manipulating locally stored images using a locally stored HTML file via javascript and of course, jQuery. The image files, the HTML file with javascript, and JQuery.js are all stored on my ...
0
votes
0answers
9 views

Using external JSON file in JS: Access to XMLHttpRequest error

I'm trying to save my API key in an external JSON file and then import it into my Javascript file to use later. I have this in secrets.json: { "api_key":"123456789", "username":"my-username" }...
0
votes
1answer
14 views

Converting from JavaScript to JQuery

I'm trying to convert this code I wrote using JavaScript into JQuery. Anyone have any tips or resources to help me figure this out? JavaScript is so much easier for me to pick up compared to JQuery. ...
0
votes
2answers
28 views

Assigning value to function as object property within for loop

I am trying to create an array of objects. One object property is a function, which I want to change value of depending on which number in the array the object is. When I try to use the 'i' value ...
0
votes
0answers
4 views

CyberSource API implementation with 3d secure and Soap

I have already implemented a system with soap CyberSource which integrate a website to CyberSource. I have followed the rules from github(https://github.com/CyberSource/cybersource-sdk-php). However ...
0
votes
0answers
10 views

Jquery parallax effect on simple background image slider

I have created/modified a simple image background slider with a fading transition based on some code from someone else for learning purposes. Now I am trying to implement a parallax scrolling effect ...
0
votes
1answer
19 views

how to detect when a message gets edited

Hi so I'm trying to make a discord bot that deletes certain words I've managed to do this but I want to make it so it will delete edited messages This is what I've got so far client.on('...
0
votes
0answers
7 views

Fluent ffmpeg not running synchronously

I am writing a program where I need to process a video multiple times using ffmpeg. The ffmpeg codes (below) are inside a 'then' statement of a promise. ffmpeg(path) .size('640x?') .aspect('1:1')...
0
votes
0answers
22 views

when i createElement in one function, when i getElementById it results in an error

so this is my html code, now i know itd be easier just to code the elements into the html code, but i need to be able to create the element in one function, and modify it in another. so this is mt ...
0
votes
1answer
15 views

I am trying to query timestamps in firebstore

Here is my code. Right now, I am just trying to make sure I know how to format my date to get it. I have tried Month-date-year and that didn't seem to work. I was able to get the object that firestore ...
0
votes
0answers
18 views

How do you disable an app on chrome OS with javascript?

I am a bit more experienced with making games than interacting with files in ways this significant. I am trying to make a little GUI that can disable an app (on Chrome OS) and re-enable it. I have ...
-2
votes
0answers
15 views

how do i return the value from the .then() block to the parent function [duplicate]

getData(link, attribute) { const data = {}; fetch(link) .then(response => response.json()) .then(resData => { data[attribute] = resData[attribute]; return ...
0
votes
1answer
30 views

Update a react state (array of objects) from a child component

I would like to update the parent state from child component, which renders each object of the array of objects. The main goal of the child component is to update the original value from the array of ...
0
votes
0answers
6 views

phpseclib not verifying a signature generated in window.subtlecrypto

So yeah my boss wants to put encryption into his system and he wants messages signed in js and verified in php. currently, I'm using mozilla's subtlecrypto api to generate RSA-PSS keys and sign and ...
0
votes
0answers
12 views

JSS <ThemeProvider>, how to use media queries

I am trying to use to define some default colors that I want to use within my child components. The problem is that I also want to be able to set those colors according to media queries. For example: ...
0
votes
0answers
12 views

Sapper/Svelte.js - How to specify client-side assets location?

I have a Sapper.js application that I have successfully running on AWS Lambda. Lambda is able to deliver the server-side generated HTML created by Sapper to AWS API Gateway which then serves the app ...
1
vote
1answer
37 views

fastest algorithm to remove duplicate consecutive words in a string?

Here's what I got: string = 'John bought bought black paint for his black car' words = string.split(' ') duplicatelessWords = [] for (const word of words) { if (duplicatelessWords[...
0
votes
0answers
7 views

Error loading JS files with my Open WC Karma-Esm plugin

I am new to the Open WC Karma-ESM plugin. I've taken the standard Karma configuration file from the documentation: /* eslint-disable import/no-extraneous-dependencies */ const createDefaultConfig = ...
0
votes
3answers
39 views

How can I create a list where I can add and remove inputs via buttons?

I've an idea. For this I need a list like this draw: So the main idea is to have a plus and a minus button. When a users presses the plus button, another input get's added. When pressing the minus ...
-1
votes
0answers
13 views

Finding the most occuring numbers among sets of numbers [duplicate]

Finding the most occurring number(mode) among sets of numbers using JavaScript.. var nums = [2,3,3,2,1,5,3,4,6,3,3,2]; Here, the most occurring number is 3.. How do we achieve that using JavaScript.....
0
votes
0answers
15 views

Multiple condition if statement with regexmatch

I wrote this code, but for the life of me I can't get it to validate correctly. There is data on row[14] defined as var voicemailed. Some of these cells in this column on Google Sheets contain 'VM' ...
0
votes
1answer
27 views

React - index starts after array is filtered

I have some products that I am trying to display in my app. Some of the products are marked as featured and I want to exclude those products from this section. I also want to show only the first 4 non-...
0
votes
0answers
6 views

Grab multiple Dates from a cell range and converte to numbers

I am trying to create code in javascript for google sheets in order to grab multiple cells with dates and convert the dates into numbers in order to make comparisons between dates. Anyone have an idea ...
0
votes
0answers
7 views

scrollspy nav bar sticks on active after scrolling away

I am using a scrollspy navbar so that the navbar automatically switches to whichever sections that the user is on; this works fine. Although if I click on a section e.g. 'Contact' and I then scroll up ...
1
vote
0answers
7 views

Next/React-Apollo: React props not hooked up to apollo cache when query comes from getInitialProps

I'm using nextjs and react-apollo (with hooks). I am trying to update the user object in the apollo cache after a mutation (I don't want to refetch). What is happening is that the user seems to be ...
1
vote
1answer
24 views

React: Spread the return of a function in one line

Is it possible to spread the result of a function directly, instead of storing then spreading it? In other words, is there a way to reduce these 2 lines into one? const toto = removePreviousCase(); ...
0
votes
1answer
18 views

Can you use parent function variables inside a returned function in javascript?

Here's the function code: function TestFunction(number){ return function(e){ return `${number}`; } } When I use it on google's devtools command line it returns: function(e){ return `${...
-3
votes
1answer
16 views

To remove repeating characters from string (need no pattern). Javascript [closed]

I need some function on JavaScript please, that gets a string and returns a new string BUT without repeating characters. For example we get "everyday" and it returns "evryda" like this.
0
votes
0answers
19 views

Array class variable in Javascript classes (like in ruby classes?) [duplicate]

So in ruby, we can have a Class variable array to store all the instances of a class, like so class Car @@all = [] def initialize(model,make) @model = model @make = make @@all <...
0
votes
0answers
16 views

How to add a setTimeout to a Random MP3 List

The following script works well on a web page to randomize the MP3s that play from the list below, but I would like the MP3s to start playing at about ten seconds later, after page load, with a ...
0
votes
0answers
21 views

Odd behaivour of clientWidth and offsetWidth, why do they return wrong values?

I am trying to understand why the below code snippet returns the wrong value and it doesn't matter whether I use clientWidth or offsetWidth. const imgSize = document.querySelector('.slides').children[...