Category "javascript"

CORS error with OPTIONS request using AWS CDK

I am using AWS CDK to run a RESTful API and I am getting the following preflight error when calling a POST endpoint: Access to fetch at 'http://localhost:4000/

How to clear a React Bootstrap textarea form control after the form is submitted?

I have a form made with React Bootstrap to semply submit a string that will be saved on a DB. It works and the submitted message is saved, but I don't know how

How do you extract an array or count the elements in Javascript if we don't know how big is it?

I have an array like this: const fruits = ["apple", "peach"] And I have a second array like this: const sold = [ ["sold", "not"], ["not", "sold"], ["sold", "no

Javascript code broken in firefox browser only

I created a div C. Its absolute position is setted to stay between the bottom margin of div A and top margin of div B. Every div is a rectangle with same width.

How to ng-repeat this table row and increase the ng-show row position value instead of hard coding the values

I am working on a feature which allows a user to create their own table. I'd like to refactor this code. So it creates a number of rows based on the max rows I

Click event not updating global variable

I have a website with 2 pages. In the first page (landing page), I have this clickable element: <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12" id="arrest-

react conflit package.json

ERROR in Plugin "react" was conflicted between "package.json » eslint-config-react-app » D:\Projets\Roster's\Client\node_modules\eslint-config-reac

Photoshop change top text layer name to same as file name

I have 1000s of psd file to change top layers as file name. Please help me to crate a script for this. I want to have a JS-Script, which changes the Text of the

How to change from page-2.html the option from dropdown menu with onclick function from page-1.html

I want to split the below code to two pages instead of one page. The code you see is inside to page-1.html. When you click the link "set to val1" the dropdown c

attributeChangedCallback() always called twice ending up with multiple event listeners

Playing around with custom elements, I'm trying to get a click event fired depending on custom element attribute's value. But using the attributeChangedCallback

Ineffective mark-compacts near heap limit Allocation failed error when building next.js app

I have a next.js app running inside a docker container in a EC2 instance. When I run docker-compose up this will trigger the next.js app to be built. Now it is

How to flush promises since Jest 26+

Jest 26 shipped a new implementation of fake timers based on @sinonjs/fake-timers. Previously I used const flushPromises = () => new Promise(setImmediate); a

How to add multiple array items as HTML content?

I need to extract some words from a string of text, insert every character of that words inside a span element and then replace the extracted words with the spa

Images uploaded from Safari gets cut off

I have a form in a web app where you can upload an image, and then i send a POST call to a GAS script. Then in the GAS script i save the image in a Google drive

How to integrate js anim in vuejs

I have 2 files for an animation: Index.html and lazy-line-painter-1.9.6.min.js I want to integrate this animation to my vuejs code. I tried to put everything in

How do I pass a function with argument into event Listener

In my drawing app I have a function called addMouseOver. It adds an eventlistener to all squares so that when you mouseover them they turn black. The problem is

Difference between NodeJs preload option (-r) and explicit require in in REPL

I'm using esm which is a very useful package to support ES import keywords. According to the doc, in REPL, it can use preload command-line option to initialize

CryptoJS AES decrypt Hex String?

This is sort of a part two to the question Trying to print hex string with CryptoJS Basically, I have a function that uses CryptoJS to encrypt a message and spi

Sorting Algorithm for Tasks with Dependencies in a Gantt Chart

I'm building a Gantt Chart with dhtmlx-gantt that contains parent and child tasks. A parent task can be a dependent on another parent or child task A child task

TypeScript function that works on all numerical array types

I am trying to write a function that works on all of the JavaScript array types, e.g. on number[], Float32Array etc. It should return the same type that it gets