Category "javascript"

Text input field won't submit when pressing enter

I have a text input that I am trying to use to create new tags via hooks. However, when I enter in the value and press enter, nothing happens. I Googled it and

post request using crud crud in react js

Trying post request in crud crud dynamically using fetch api but its showing error net::ERR_ABORTED 415 (Unsupported Media Type) const addItemToCartHandler = as

How to pass a function from Parent to an element within a route in React.js?

I want to pass a function to a component through a Route , I can do it with direct children but when it comes to Routes i can't figure it how to do it. look at

How to use local storage in my TODO list js

I'm trying to solve a task in javascript, I'm learning but don't now how to use the local storage, or how to use it in my todo list, I can add task, mark them a

next-images Error: Module parse failed: Unexpected character '�'

I'm trying to load an image with next-images: when i type in the image name it works fine: //Working <Image src={require(`../../images/exampleImage.jpg` )}/&

How to hide buttons based on your "job"?

I am creating an app and I want that the buttons appear based on your $job. There are 4 jobs, which are all in mysql databases: student teacher staff principal,

Produce CSV from JSON object

I have a JSON Object like so that I am trying to produce a CSV from { "football": { "count": 2109, "emailed": 0, "optin": 2109,

Html ReferenceError: document is not defined

My error = ReferenceError: document is not defined document.getElementsByClassName("text_status").innerHTML = 'hello' I am trying to change the text of an elem

Deploy different from view on local server

I was building a site and during building I checked it out through live server and everything was OK. Now after deploying on netlify. The site looks different a

I am having trouble understanding the Leader-Line js documentation

I am trying to create code that will draw a line from point a to point b using the leaderline library. https://github.com/anseki/leader-line It looks like the s

Apollo Client useMutation data always returns undefined

I have the following code that runs a mutation to update a post to "published" the mutation works great! It updates the data as expected. However, the data prop

How to change network in metamask using react js

I am developing my first Dapp, I am using metamask and web3 for this. As far now, I am able to get my wallet balance and connect account to metamask. Now I am t

Jest: to check if a function is called by a specific instance of class in JavaScript/Typescript

I am testing some express middlewares with jest. it("should throw 400 error if request.body.id is null", () => { const req = { body: { id: null } } as an

Can't seem to identify the issue (splitting an array in chunks)

So this function is supposed to split the array into chunks the size of the second argument, e.g. [1, 2, 3, 4] with the second argument 2 would return [[1, 2],

How to set download url in a table row

I've this javascript function that takes the ajax call's result and build a html table with it. This table rapresents list of reports. Each row of a table is co

QUnit - Testing functions of files besides formatter.js

The example given by UI5 of testing the formatter functions i.e. // Assert assert.strictEqual(fnIsolatedFormatter("A"), "New", "The long text for status A is co

Regex for double quotes inside string

A follow up to my previous question here. I realize I need to be more specific regarding my regex case to get an answer that works for my case. I am fighting w

Webos clear localStorage when uninstall

I'm developing a webOs app with vanilla JavaScript. The app don't pass the LG QA processing because when uninstall the app and install again the keep users toke

useSelector doesn't update value in Next.js

I have a problem, createAsyncThunk function makes request to server (axios) and then get data, after that extraReducers handle builder.addCase in it and makes s

Finding documents that fit json input in mongodb

I'm trying to do a write statement that finds all the documents that fit the JSON data fed through a form. Here's an example of what the JSON looks like. I crea