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
3 views

Button does not respond to DOM cssStyleDeclaration

I am sure this is a simple bug but I´ve been over an hour trying to find where the problem is and definetely could use a different point of view. In the following function I change the style of two ...
0
votes
0answers
5 views

Object.keys and Object.values return zero array of an object

I have an object and need to get an array for each keys and values. I used Object.keys (also tried Object.getOwnPropertyNames()) and Object.values() but both returned zero length array. I confirmed ...
0
votes
0answers
4 views

React does not change state after updating state in usestate hook (in custom function form)

I am using usestate hook in react 16.10.2, but after updating initial state using custom function in usetate hook, react does not trigger a re-render(OtherComponent is not rendered), Here is my react ...
0
votes
0answers
6 views

Why is Android not returning any contacts?

I have an app where users can import their contacts. The code for this with expo-contacts is: const { status } = await Permissions.askAsync(Permissions.CONTACTS); if (status !== "granted") { Alert....
0
votes
0answers
14 views

How to correctly update state via usestate?

I have a form component which imports a custom hook component like so: const FormsPage = () => { const [submitForm, formState] = useSubmitForm(); const { values, errors, handleChange, ...
0
votes
0answers
8 views

Change the css style for new item in select2 multi select box

In below example, "#Multi-select boxes", how can we highlight new item with specific text. https://select2.org/getting-started/basic-usage so, existing loaded item in multiple select - item1 item2 ...
0
votes
0answers
7 views

How can I iterate through the rooms in Socket.IO?

I'm trying to create a list of buttons where each one of them represents an avaialable Room. So when the user clicks a button they will join that room. My problem is that I cannot find a way to ...
0
votes
0answers
10 views

How can I use javascript function .push() safely with mongodb?

I'm trying to run a http update request for database, in which I push a new object into an array. I'm using mongoose with mongodb I could call the collection and push as so: collection.findById({_id: ...
2
votes
0answers
15 views

How to test auth headers with Jest?

I am attempting to test the auth header when doing an api call: import axios from 'axios'; import ApiClient from './apiClient'; import ApiService from './apiService'; describe('apiService methods', (...
0
votes
1answer
17 views

How can I pass data from .js to .vue?

I am trying to load data into my .vue component file from its parent .js file. This is my .html file: <div class="modal-container"> <section class="modal"> <modal-...
0
votes
1answer
11 views

Mongoose: Whats wrong w/ my findByIdAndUpdate?

my idea is very simple, it is get the update value from req.body, but it doenst work properly, the data never change in the mongodb. already tried the {$set: email, password} const id = { _id: ...
0
votes
0answers
15 views

How to merge object of array and only increase amount property? Javascript array of objects

I am creating a recipe book application in Angular 7 which has shopping list feature. What I want: When a person adds recipe ingredients to shopping list twice it increases only the amount of the ...
0
votes
0answers
8 views

Images slideshow looping and animated with the rotation effect

I'm sure this exists but I don't know how it is called, so I don't succeed at finding it on the internet. I'm trying to do an image presenter which can loop with a rotate effect, very similar to what ...
1
vote
2answers
14 views

getComputedStyle not being updated when updating style for test

I want to create a mock div that has display: none for testing purposes. However, setting the display in the test and then calling getComputedStyle shows no change in the style, i.e. const parent ...
0
votes
1answer
23 views

Include Modal functionality in React Higher-Order Component

I created the below HOC which I can use to wrap a React component to add 2 inactivity timers: the first to show the user a warning; the other to log them out. I got the idea from here and it seems to ...
0
votes
1answer
36 views

Javascript: change the colour of a radio button if it is checked and submitted

I am very new to javascript and started to work on a quiz. When the submit button is clicked I want the checked (false) radio button turns to i.e. "black" I tried to read forums however i have not ...
0
votes
0answers
19 views

Need Help Transferring Data Between HTML Tables

I have two tables, one with a list of players for you to choose with a checkbox and another where the players are supposed to appear after clicking the checkbox. There is also a div in table2 that ...
0
votes
0answers
12 views

Trying to get Adblock to work on local HTML files

I'm trying to detect adblock when I open an HTML file locally on Firefox. So far my solution has been to look at the blocklist - I see that js/ads.js is on the blocklist so my script is $(document)....
0
votes
1answer
23 views

How to use offline Jquery?

I am trying to run Jquery without internet connection, and I have problem with the path to it. My project is in ASP.NET core. When I entered code like this:<script src="jquery-3.4.1.js"></...
0
votes
0answers
5 views

How do I resolve Heroku error H18 when using a proxy server on Heroku?

I'm trying to deploy an app with a proxy server to Heroku. My requests all work on localhost, but as soon as I push up to Heroku, I'm hit with this error: 2019-10-15T16:48:08.600492+00:00 app[web.1]: ...
0
votes
0answers
7 views

scroll magic scene navigation

I am using scroll magic to move around four scenes that ive created, this works perfectly on the mouse scroll. with the first scene going horizontally to the second and the second screen going ...
0
votes
0answers
6 views

2d array in react. infinite grid component with zoom

I have problem with 2d array in react. i'm trying to build infinite grid component with zoom in react like this one http://jsfiddle.net/L3075pd4/2/. how can i print an 2d array in react and how i can ...
0
votes
1answer
30 views

Increase the time on the progress bar

I have a website that does subtitle translation but before translating the subtitle progress bar finishes loading and shows a download button so my visitors save the incomplete subtitle. Is there any ...
0
votes
1answer
14 views

Object Modify Problem on Dynamically Created Element EventListener

I ran into a very interesting problem during use event listeners on dynamically created elements using Vanilla Javascript. I will first define the problem and later post the code. I create dynamic ...
0
votes
0answers
6 views

Equivalent Cryptojs code to Pycryptodome?

How do I convert the following Crytojs javascript code to Python Pycryptodome? function encrypt() { var l; var n = "190.207.78.120"; l = CryptoJS.enc.Base64.parse(btoa("...
0
votes
0answers
8 views

Error trying to install Certificate on browser using JS

In my code I have a button that calls a JS file, which in turn calls a PHP file that has the API endpoints that I need to generate certificate, and sends the response back that I use in certificate ...
0
votes
0answers
11 views

Relative path for axios url request requires a '/' prefix for local but not hosted server

Not sure if this is an axios issue or not, but this works for me locally: axios('/api/test').then(response => console.log(response.data) But on my hosted server, it requires this: axios('api/...
0
votes
0answers
10 views

How to fix issue with Webstorm HTML Live Edit opening when I press the “1” key?

Currently in Webstorm 2019.2.3, when I am editing an HTML file and try to hit the "1" number key, Webstorm opens up Chrome and tries to display the HTML. This is very annoying, as it is preventing me ...
0
votes
0answers
12 views

Testing async componentDidMount() with react-test-renderer

I have a component which does some SQLite loads in it's componentDidMount() function async componentDidMount() { try { const user = await this.userDao.getUserData(); const ...
0
votes
0answers
22 views

React Calculator: How to prevent multiple decimals?

I have almost finished building a simple calculator, using React. I just have a trouble with multiple decimals. What I try to do is writing a condition but it doesn't work. Could you help me, please? ...
0
votes
0answers
16 views

How to filter elements based on two seperate filters using jQuery

I have a blog where I have built a custom dropdown filter, and I have it working with one dropdown as you will see here: https://codepen.io/Canvasandcode/pen/zYYqQNx Here is a preview of the jQuery ...
2
votes
0answers
23 views

How can I fetch data with jquery .load, only when the target page's DOM is loaded?

I have this page where I have a ranking system. For the ranking to display I create some elements on a loop through javascript, according to the data that I fetch from the database. Then, I want the ...
1
vote
0answers
12 views

onfocus=“blur()” only on mobile devices

I have created a custom soft keyboard for mobile devices. The problem is that each time I click an input box it pops up my custom keyboard but it also pops up a soft keyboard of the device. Now, I can ...
0
votes
1answer
27 views

Changing event to on.click for searching terms

I have this snippet found below which highlights and jumps to the searched term. The current snippet searches after each keystroke that the user inputs which is putting too much stress on the server. ...
0
votes
1answer
30 views

typeof won't work when checking a function that's passed as a parameter [duplicate]

New to javascript. I want to check if temp is a function or not. Also I would like to know why typeof won't work in this situation : Situation where a function is passed as a parameter. Understanding ...
0
votes
6answers
41 views

Loop through json and fetch specific values in nodejs

I have a scenario where I am trying to parse through this below json and get all the value of key "name" and key "id" , which I would further store in a variable or array. [ { "...
0
votes
1answer
31 views

How to fix stopwatch from incrementing when “start” is pressed?

I've created a simple stopwatch. It has 3 buttons, "Start", "Stop", and "Reset". They work, but there are some flaws. Once I hit "Start" it continues to increment and speeds the clock up, which causes ...
1
vote
0answers
35 views

JavaScript crawler .push() and pop() method works in terminal but returns error in console

For the past month or so I have been trying to learn JavaScript in order to make a web crawler for local music venues in my hometown, things had been going great as the crawler worked perfectly in the ...
0
votes
4answers
30 views

Set HTML Form Input To JS Variable

I want to read user input into a form back to them, sort of a confirmation before they send it in. I have some text elements on the page with their corresponding IDs. I would think that I just need to ...
0
votes
0answers
9 views

Bootstrap 3 tooltip arrow does not display properly with multiline message

I have a link with a tooltip on it. The tooltip message is a bit long so it's displayed on two lines. <a href="/link/1234" class="tooltips" title="See the comment">Comment</a> My problem ...
-3
votes
0answers
13 views

Open flipboard share modal

i'm trying to make a flipboard share button that opens as a modal , similar to facebook share button Facebook modal This is the code i used on my onclick <a class="linking" href="javascript:void(...
1
vote
0answers
8 views

Re thread: How to load nav menu from an external file?

Re thread How to load nav menu from an external file? (No Wamp, all code must be 'browser-side') I tried Thomas James's solution (Javascript) from the top of the page. Works beautifully in Firefox (...
1
vote
0answers
12 views

How to make multiple animations in one page with Lazy Line Painter

I'm making a card where I want to put svgs with this drawing effect. I found a very good tool that makes this for me, I download any svg from the internet and it makes the effect for me and gives me ...
1
vote
3answers
48 views

Javascript window.print() method only works once

I have the following code snippet I have implemented on some Angular project in one of the components. I can print successfully but when I try the second time the onClickPrint() method is not ...
0
votes
0answers
8 views

Firebase onCall HTTPS function returns {data: null} when trying to connect to MySQL [duplicate]

I am trying to send a query from my Vue.js app to Firebase Functions, there check logged in user (with Firebase Auth, that's why I'm using onCall function) and send the query to MySQL server on Google ...
1
vote
0answers
24 views

Scroll-snapping breaks jQuery animated scroll

I have a scroll view with mandatory scroll-snapping: scroll-snap-type: y mandatory; I also have some buttons which provide shortcuts to the different elements of the scroll view. When a button is ...
0
votes
0answers
24 views

Redis caching in nodejs

So I was looking at this module, and I cannot understand why it uses callbacks. I thought that memory caching is supposed to be fast and that is also the purpose someone would use caching, because it'...
2
votes
1answer
28 views

VueJS - How can I have multiple v-slots?

I am using vee-validate v3.0 to do my validation and the setup went well, but now I am trying to style my elements but I can't seem to get it working. I followed the very short documentation about ...
0
votes
1answer
9 views

D3 access html attribute

I have the following code to loop through all rect nodes: d3.selectAll("svg g rect") .on('mouseover', function (d) { console.log(this); }); Console.log prints: <...
-2
votes
0answers
19 views

node.js live voting application with ip address of voter from vote submitted

I am working on a node.js application similar to this: https://github.com/Srushtika/realtime-voting and wanted to check if there's one I can reuse and extend for my use-case. I am planning to create ...