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 rendering and manipulating 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

Trying to define a promise.all

I am trying to understand how promises work by creating the Promise.all method from an exercise of this book: https://eloquentjavascript.net/11_async.html#i_Ug+Dv9Mmsw I tried looping through the ...
0
votes
0answers
8 views

Open the xx.html file based on drop down menu from Navigation bar, code is written in Django-Python

The code is written in Django-Python. The project is created using the models in Django and shown in navigation as dropdown menu. The drop-down menu is shown using the Django-HTML as shown in ...
0
votes
0answers
8 views

Why does sumbitting a form for an AJAX request using “onchange” on an html element on Rails an “Authenticity Token” error?

I am trying to trigger an AJAX request using a select element in a form. I use the "onchange" event on the select element simply to submit the form. In addition, I have submit buttons within the ...
0
votes
0answers
9 views

Search/Replace not working with Bootstrap Notify

So I'm trying to 'word wrap' my bootstrap notify function so that long messages dont span the entire screen. I have this, which works fine on its own: https://jsfiddle.net/2kd3uner/ message = ...
-2
votes
0answers
21 views

Random Image but correct title

I'm trying to build a random button that when clicked it returns a random image from my folder and some text with a "var" representing the name of the place. So it has to match, the title an image. I ...
0
votes
0answers
14 views

Auto width under max-width of SVG as background-image in CSS

I am trying to use an SVG image in header so it has a max-width of 650px (and auto 100% height) and when window (or device) gets under 650px, it becomes 100% wide (with auto height scaling). ...
0
votes
1answer
7 views

Python GEE to extract featurecollection timeseries from Landsat imageries

I have a featurecollection for which I need to extract timeseries of NDWI from Landsat imageries. Here is the javascript functional code I used to extract timeseries: https://code.earthengine.google....
-1
votes
1answer
26 views

How to write negative binary number? [duplicate]

So 0b1 is 1. How to write -1 in binary format? The docs says that the leftmost bit is reserved for sign, but where is that leftmost bit? Even 0b11111111111111111111111111111111 is still a positive ...
0
votes
0answers
17 views

Why does the following PCRE regex not work in JavaScript?

I'm testing at regex101.com, and the following regex: quick brown (?s)(.*) jumped with the following text The quick brown fox jumped over the lazy dog produces 'fox' as expected. When I switch ...
0
votes
0answers
4 views

Create a global svelte-component that works like svelte:head

In my current project I am working with a self-developed module system, where the individual modules should also have the possibility to extend e.g.the navbar by simply writing some HTML inside a <...
0
votes
0answers
6 views

How to pass initial form values to child component in Vue.js?

I'm using Vue.js. From my template I include the child component (componentB) which includes several input elements. I want to initialize those input elements from my parent template. I found a way to ...
0
votes
0answers
5 views

Showing Realtime Data using C3 JS: Gaphs

what I am trying to do is that I have a graph which loads completely at the moment I enter the button to show the data. The graph looks fine as Shown below : But I dont want to make the data looks ...
0
votes
0answers
16 views

Why is my input validation from jquery wont work?

I want a validation onkeyup from an input form, I've made a jquery. I'm having a hard time finding why is it not checking? I need to go to a php page in checking. What could be wrong to my code that ...
1
vote
0answers
11 views

Is it required to removeEventListener on an unmounted element/component?

If I attached event listener to a component, do I need to explicitly to remove it when it's unmounted? For e.g. componentRef = React.createRef(); handleWheel = (e) => { e....
-1
votes
1answer
13 views

Why is echarts not loading?

I have a completely blank page, with the follow call to a js file: <script src="https://echarts.baidu.com/dist/echarts.min.js"></script> I am not able to even load the file, I get the ...
0
votes
1answer
11 views

Unable to set property of individual object

On using a local variable like I have used, I can set sizeSelect for a product in the mapped list and add another product to cart since sizeSelect changes.I want to give each product in the list a ...
1
vote
1answer
15 views

Why Named Function Expression itself cannot assign Name to another Value? [duplicate]

var functionVariable = function functionExpressionName() { functionExpressionName = 1; console.log(functionExpressionName) // function }; functionVariable(); If You run this example you can ...
0
votes
1answer
16 views

How to reset scroll position on single page pagination

I try to fix scroll location. When clicking on another pagination, scroll location does not be reset. Front : React css framework : semantic-ui-react Paragraph = () => ( <p style={{...
0
votes
0answers
9 views

What's the difference between a page load in a new tab or in a new window ,in terms of modal popup form functionality

Mvc modal popup form doesn't work when the page is opened as a new tab ,But its works when the page is opened as new window In Main page, I have dynamic tab which loads #Rep_Contracts , And in #...
0
votes
0answers
6 views

Is there a way to sort strings inside an array, based on parts of the string?

I'm trying to program a simple Italian dictionary. I want to be able to sort by parts of the string. I'm keeping the Italian, English, and information together. Here's a link to the full code: https://...
0
votes
0answers
7 views

Is there blackhat morphological Method in “Jimp” that I can apply on image?

I'm trying to prepare image to be ready for tesseract.js and I'm using Jimp for that. So I need something like Blackhat morphological Method to convert image like this to something like this If you ...
0
votes
3answers
19 views

How to scroll to bottom of page, when a new message is sent - Socket.io

I'm attempting to create a chatapp on a webpage. I have a list of messages being sent. Problem is, that the newest messages aren't making the page autoscroll to that message. I tried: socket.on('...
1
vote
1answer
10 views

How to reconstruct audio blob from a base64 encoded String?

I am capturing audio data via JavaScript and intend to send it as a base64 encoded String. Before I even send it, I'm just testing to see if I can reconstruct it and play it, and I'm not having much ...
-1
votes
0answers
6 views

Mistake in page section scroll script to id with mousewheel

There is a site written with scrollr js pluggin. The example below or another additional link to the same example (https://codepen.io/RukUndead/pen/bXwyZJ) . The task is to make step-by-step scrolling ...
-1
votes
1answer
12 views

Unexpected Identifier using discord.js

Hi so I actually have NO knowledge of coding, but i've watched some tutorials and it seems like this code should be working but it is giving me an unexpected identifier error. It isn't my code but ...
-2
votes
0answers
13 views

How can this jQuery plugin can be improved? [on hold]

I created this plugin years ago and have improved it on a per-project basis until, finally, I made it a bit more open-source friendly for a client to run with. It's basically a plugin to "fix" an ...
-1
votes
1answer
15 views

How to Detect Back keypress anywhere on web page

I have a list of users, and I get to their details through that list. Now when user details are opened I want to send the user back to the list of users when backspace is pressed. How do I detect ...
0
votes
2answers
26 views

How to calculate numbers within an array of objects

I have an array of obj where there are some numb and I want to find the sum. I know how to achieve this with a simple array but in this case it seems confusing. I tried to use reduce as we do ...
0
votes
0answers
16 views

How to add html + blade into javascript variable for google maps api

I'm using Google Maps API to build a MAP with users on it. So I wanted to add info windows on my map, that works ! But I also wanted to insert avatar and a link to the user's profile, so I'm using ...
1
vote
4answers
33 views

Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked

I now contain a list that contains several li and each li contain a circle I would like a way to efficiently and not hardcode a way to change the class of each circle that was not clicked to disabled ...
-2
votes
0answers
14 views

JavaScript is throwing error NaN while trying to work with numbers [duplicate]

I need some help troubleshooting the below piece of code. I have property age, which holds a number, I get an error while I try to access it and do some mathematical operation (subtraction). // ...
-1
votes
0answers
13 views

Null-conditional operator in javascript? [duplicate]

Note: Null Conditional Operator is different than Null Coalescing Is there a "null coalescing" operator in JavaScript? In python, c# we have Null Conditonal Operator ?. we still lack ...
0
votes
1answer
8 views

Is there value in propTypeing repeat required properties at every level of nested components?

Say one component always calls another, but maybe adds some properties. Do you propType for required properties in this component even if they are checked in the component it calls? Or only at the ...
0
votes
1answer
19 views

Call function if variable does not exist in a filter

I'm doing filtering on a data displayed in a view which is working correctly. I've placed a filter bar at the top of the screen where a user can filter the records. What I want to achieve is when the ...
0
votes
3answers
40 views

How to add to a jQuery queue dynamically?

My problem is: I want to add animations to a jQuery queue dynamically. What I mean by dynamically is that the number of times, that I want this animation to be added to the queue, is some sort of ...
0
votes
0answers
13 views

How to hash large state object between every modification (collisions and speed)

I have a rather large state of an Entity-Component architecture, containing about ~500k entities, with each about 3 - 6 components attached, so about ~3 million components. My components are all data ...
0
votes
3answers
44 views

localStorage value doesn't get updated automatically

I have a simple React App. I defined several routes and one of them is Login. After user logs in successfully in Login component, I want to display his username in the top menu. I'm using localStorage ...
0
votes
1answer
13 views

React.js modal not show with Semantic Ui

I am trying to show a modal onclick with reactjs, I know there is a certain semantic ui plugin for react, but I using jquery version. Well what I have tried so far is: index.html <link rel="...
2
votes
1answer
27 views

React not updating state with setState correctly inside promises

I'm trying to load some more data from an api inside a react component on button click. This data should get merged with the already loaded data. While loading I want to show a spinner. I am using ...
0
votes
1answer
10 views

How to render React Native flat-list with object of objects?

I have React Native flat-list component. My output data is an object with keys and objects. And i need to render keys and values from objects. Can you tell me please witch will be the best way to ...
3
votes
0answers
42 views

Direct native JavaScript or jQuery method to get containing block of an element

Is there a built-in DOM API or a jquery one to get the containing block of an element? I am not asking how to get the containing block of an element. I am just asking if there's already the wheel so ...
-1
votes
0answers
8 views

Conditional “test harness” code for my React NPM package?

I'm writing this app using React and I was trying to package it up in NPM to use it in a different project. I have as my index.js entrypoint something like this: import { MyReactComponent } from './...
0
votes
0answers
18 views

filter data according to dates

I want to filter data according to a given date range picked up in templates by user.I have a list I want that if User enter date and it matches with the date in a list then that data should be shown ....
1
vote
1answer
10 views

How to configure bootstrap input spinner to change input's value when press + or - button only?

I use bootstrap input spinner such as below code. In this case after i press + or - change event of input called repeatedly. Is exist a way to configure bootstrap input spinner to call change event ...
0
votes
1answer
19 views

Dynamic JSON object to Html Table

I have gone through this solution Parsing JSON objects for HTML table . But in this solution Object keys are pre-defined when creating table. But I have some json data which can have random data. ...
0
votes
1answer
21 views

How to send Id and file to same controller?

"i want to send id and file data to same action uploadFile(int id, httpPostFileBase upFile) ?" i tried to send the patient id via ajax during submit, and file using name attribute in input tag. @...
0
votes
0answers
17 views

How do I save blob url to base64 or Image file

Using react-easy-crop plugin crops image and gives cropped image as blob:http://localhost:2077/a092be04-eeca-4663-b0d2-3fb4b4739e2b file. I need to convert this to base64 or an image file. How do I do ...
0
votes
1answer
16 views

How to Make a jQuery Table Cell(td) clickable to Run a Function?

I am currently passing the button class to a function when the button is clicked. I want to switch from using buttons to using the td/cells in a jQuery table. So when I click on the image in the cell, ...
-3
votes
0answers
28 views

Why to use super() inside constructor in js [duplicate]

I am new to JS and was learning OOP. The confusion I faced is that as you can see in the code below. Super() is used inside constructor and I cannot get WHY? Why do we need to use super() inside ...
0
votes
1answer
41 views

Prevent the duplicate function onchange event jQuery

I have this snippet below $(document).ready(function(){ $("#selectTest").change(function(e){ if($(this).val() == "01"){ $(".show").hide(); }else{ $(".show").show(); ...