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
0
votes
0answers
8 views

React hooks - How can I return a hook call from useMemo

I am using a custom hook like so: const { register, getValues, unregister, triggerValidation, } = useForm({ mode: 'onChange', }); const values = getValues(); Then I am using ...
0
votes
1answer
14 views

var x=document.getElementById(“mytext”).value;Why i change the value to innerHTMl or innerText,it do not work?

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <input type="text" id="mytext">...
0
votes
0answers
10 views

mapping json from a fetch function into setstate

I am trying to map a json response into a state, what I am trying to do is map all the children of this array no matter how many, as in skipping the first array and only show its children, here is ...
1
vote
0answers
8 views

How to deploy a static website to AWS S3 using nextjs [Please save me]

I am still new to React and I started writing a static website using Nextjs. But when I want to deploy to AWS S3 I have some problems. I used to use webpack only and when I type yarn build I get a ...
0
votes
0answers
18 views

Make height of list fill whole page

I am currently trying to make a page with a map on one half and a list on the other. I want to make the list height fill the entire page but I can't seem to find the right way to do so. I am using the ...
-2
votes
1answer
17 views

Chatroom application

I was wondering how I can create a local chatroom using a website / app that connects to a server which will only allow the users that are connected to the router(LAN) to be able to chat.
0
votes
0answers
9 views

How do I stop Javascript Foliotek's Croppie from overwriting previously cropped and uploaded images on the same page with the latest uploaded image

The scenario is I'm uploading and cropping up to 4 images to a page. Once an image is cropped, it will appear on the page. However, when i go to upload and crop a second image, this second image ...
0
votes
1answer
18 views

Using Filter Method to Remove Item from Array

I am new to React and I am trying to build a very basic timesheet tool, where users can add tasks into the application and save. I am using React as well as Typescript. So far I have my main ...
0
votes
1answer
21 views

How to detect changes in input text field and enable save button

I am trying to code a function where it detects changes in the text field and enables the save button. This is running in Visual Studio 2017, HTML , JavaScript (function () { var ...
0
votes
0answers
10 views

Cart Array is not updating correctly

I have a cart object with property items[] and want to update the ui when the user added a product button and the view cart is clicked a div is open with all the products in the cart.items[]; I ...
1
vote
1answer
17 views

Fetch data in array's order

I have an array which contains a list of IDs. With it, I'm trying to fetch some posts data from the WordPress REST API. I managed to retrieve the data I was looking for, but the issue I'm running into ...
0
votes
4answers
27 views

Is it possible to make a function that can manipulate the object inside a particular function?

Lets say we have a function that has an object inside it and more : function myFunc() { var obj = { "one" : "1", "two" : "2" }; // And more code is down here but our main focus is ...
0
votes
0answers
11 views

wordpress website, using cloudflare as CDN, CSS on the live site keeps disappearing and sometime css classes does not work when i inspect the element

I am working on a wordpress website, using cloudflare CDN. I have dev, staging and live site, where dev and staging works perfectly fine but live site works very weird, CSS on the site keeps ...
1
vote
0answers
23 views

Get an object with null values from an array of nested objects

I have an array of nested objects. How do I get an object with null values using only a particular key in the array of objects? let headers = [{ title: 'Arun', id: 'arunId', ...
-1
votes
1answer
14 views

TypeError: Cannot read property 'includes' of undefined: using a command Array in discord.js

Making a discord bot might get tagged as duplicate but I can't find anything that fixes this sort of problem. With this code: client.on('message', message => { if (!message.content....
-4
votes
0answers
10 views

Нажатие кнопок направления не срабатывают на js

Трудно разобраться в одну сторону кнопка работает (в правую), а в другие нет. Не передвигается именно объект который должен перемещаться по логике вещей. Сама кнопка работает, потому что можно ...
0
votes
0answers
11 views

JavaScriptExecutor + WebDrive com erro: Cannot read property 'click' of null

Edited to english I am browsing a page that ** I do not have edit access ** and need to click on a text that references a JavaScript function. Navigation using Selenium WebDriver; Using ChromeDriver;...
0
votes
2answers
17 views

How to display objects within an array if they have a certain value?

I am plotting cities on a map based on their object values. I need to be able to have these plots hide or show based on their values. So far, I have the following, which will toggle all cities on or ...
0
votes
2answers
17 views

JavaScript snippet to make visual changes based on audio playback

I'm trying to write some JS that will change a square from blue to yellow if the audio has played for a second or more. Currently, no change seems to happen at all. This is the first bit of JS that I'...
-3
votes
2answers
35 views

Why am I never entering the for loop?

This is super basic, but I cannot figure it out. I'm never able to enter this for loop. this.state.things is defined, so that is not a problem. getThingsToRender(){ let thingsToRender = []; ...
0
votes
1answer
27 views

Add missing keys, values and data to json object

I have a large piece of json data that dynamically change but. Each JSON Object has a date, site_nm and more values. The dates dont match for all. The distinct dates in this dataset are: 2019-10-01,...
-2
votes
2answers
31 views

Index Item Alterer

Could someone help me out here? I'm trying to create a small javascript code snippet that selects a random item from and array and alters it to be either 'A', 'T', 'G' or 'C' (dna strands) but it ...
-1
votes
0answers
8 views

Product comparison from JSON with Vue

I am working on a product suggestion webapp in Vue. I am pulling data from a Google Sheet via a JSON api. The data is a list of products, our products and competitor products. They all have the same ...
0
votes
0answers
11 views

Electron and React; detecting electron api changes in react with electron remote

I am trying to change the style of a div tag dynamically when the electron window is maximized. In the code below I want the div class=resizer to display: none when the electron window is maximized. ...
1
vote
1answer
27 views

Illegal Character. At line '4' position '6' JavaScript Error

I've been trying to minify one of my script and all the minify tools that I've tried gave me this error. Error I get on Minify Tools: Illegal Character. At line '4' position '6' This is the code ...
0
votes
1answer
25 views

Unexpected behavior when using the same component twice in React

I have two objects incs and exps each has the properties: desc, amount and id. I would like to display the details of each object in a container as a list, and the two containers are side-by-side. I ...
0
votes
2answers
30 views

Cannot select element in the DOM

This is my index.html: <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body> <script ...
0
votes
0answers
16 views

How make it works a function on a single header in AngularJs

I'm working with AngularJs, and i want to use a single header over all my pages. For the pages, i'm using ng-route. Right now, i want to make a test for the logout button (which lives in the header), ...
0
votes
0answers
8 views

Why is my (xbrowser plugin-created) height equalizer javascript showing up as text?

I'm helping out with a company's WP site (read: I didn't design it). There is some JavaScript showing up at the top of each WordPress site page. Usually this would seem like a simple fix: verify the ...
0
votes
0answers
3 views

How to setup materializecss javascript in Phoenix elixir webapp

I'm trying to use materizecss javascript jquery features, but I'm getting below error message In the browser. Error message: Uncaught TypeError: $(...).carousel is not a function Any idea how to ...
0
votes
0answers
16 views

how to find count of a div containing specific value in react , jest and enzyme

Prior to immediate downvote and duplicate - please note that I am looking for a solution using react , jest and enzyme. I am a newbie to these technologies. I could get a few simple tests to run . ...
-1
votes
3answers
40 views

I'm coding JavaScript and html, but how to add two integers and put them in the result text

I'm trying to add two integers, in the result text box. I'm trying to add them and display the formula formula like "(num1 + num2 = value)" In the result box "5 + 5 = 10". Yet I still can not figure ...
0
votes
0answers
16 views

sending html text input ID through a php class or possible alternative?

I'm in a bit of a pickle. So I have this section where I want to display comments for a given post. In order to do that I need the postID to show all comments to that post. However I set this up a ...
0
votes
1answer
17 views

TypeError: cloneDeep.cloneDeep is not a function (or _ is not defined)

So I'm using lodash in a Node.js app, not Angular. var cloneDeep = require('lodash.clonedeep'); var original = [...]; var newOne = cloneDeep.cloneDeep(original); TypeError: cloneDeep.cloneDeep is ...
-1
votes
2answers
32 views

why the parameter in arrow function can be pass on like this?

I was watching a YouTube video talking about promises in JavaScript and came across some code that I don't really understand. const recordVideoOne = new Promise((resolve, reject) => { resolve('...
1
vote
2answers
23 views

Hide element on all click events even when clicking on an element which has stopPropagation

I have an element which I need to hide when clicking anywhere on the page, even on elements which have e.stopPropagation(). I've tried $(document).on("click",function(){ $("#mydiv").hide(); }); ...
0
votes
0answers
6 views

webgl camera top-view clipping my 3d cylinder

This is related to my other post about the missing triangle because it is the same assignment, but a different issue. I'm trying to draw a 3d cylinder shape in webgl, where the top is thinner than the ...
0
votes
1answer
25 views

Need to pass an HTML ID for an image into a variable in javascript to use in various functions

I am trying to use code from html into javascript using code from https://www.geeksforgeeks.org/how-to-get-the-id-of-the-clicked-button-using-javascript-jquery/. I am creating a memory game I have ...
0
votes
3answers
29 views

Regex remove all leading and trailing special characters?

Let's say I have the following string in javascript: &a.b.c. &a.b.c& .&a.b.c.&. *;a.b.c&*. a.b&.c& .&a.b.&&dc.& &ê.b..c& I want to remove all ...
0
votes
1answer
19 views

The request cannot be completed because you have exceeded your quota

I tried to use the javascript MediaUploader.js to upload youtube video to my own account, for some reason, I got this error in onError function: "errors": [ { "domain": "youtube.quota", "...
0
votes
0answers
16 views

React Hooks return children wrapping component

I have created a custom modal hook that extending react-modal library, but I have a problem to work with inputs when it has onChange prop on the input, for some reason, it rerenders useModalHook ...
0
votes
0answers
17 views

Horizontal slider navigation with arrow navigation

I am trying to create a horizontal navigation slider in a fixed header. I am a little lost on how to create the the fixed header with slider arrows. The below code shows a left and right arrow codes ...
-1
votes
0answers
26 views

How can I create a ranged weapon in Babylon.js? ELI5

I'm working on a little project to practice my skills. I've been wondering for quite a while, how can I create a ranged weapon like a gun in Babylon.js?
-1
votes
0answers
15 views

how to count row from single column by specific digit stored in mysql in php?

I want to count total number of rows in a specific column by specific digit from mysql database. Suppose I have "RatingTable" and My database structure is: id username rating Now suppose I have ...
0
votes
0answers
18 views

Only run window.addEventListener on desktop and not on mobile or tablet devices

I'm setting up a htm5 canvas as a background graphic that covers the whole screen. Currently the Canvas graphic refreshes every time the window changes size, so the graphic can bounce around the edges ...
-2
votes
2answers
36 views

Run async\await infinitely

I want to iterate over the playlist array asynchronously and endlessly. But the only loop that works with async\await is for..of loop which I can't figure out how to make infinite. async function ...
-1
votes
0answers
35 views

What difference between arrow function and regular function in delegates [duplicate]

I don't understand why this code does not change rooms value this.roomsService.createRoom(room,this.refreshRooms); public refreshRooms(rooms: Array<RoomModel>) { this.rooms = rooms; } ...
0
votes
1answer
23 views

How audio can be added to a drum machine in React?

I am doing FCC drum machine project in React and trying to add audio on the buttons, but could not add the sound. Can someone check that where I am making a mistake. Help is extremely appreciated. ...
0
votes
0answers
9 views

react-native not fetching content from externally visible flask server - “Network request failed” on development

I have a local flask server that has the config flask run --host:0.0.0.0 as specified in the docs. Instead of receiving a response from my flask server when i call it from react-native, I get this ...
0
votes
0answers
10 views

Embedding vue app in Phoenix project. Vue Public Path fails

TLDR - Embedding a vue app in a Phoenix app. Building the vue app with vue cli and making sure the files go into the directories they are supposed to within the Pheonix project. When built, the app ...