Questions tagged [javascript]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], etc.
2,134,322
questions
0
votes
0answers
2 views
Vuejs form get multiple value in array
I have a form which is showing multiple input based on database data and I need to get each input value plus their id when I submit my form.
The final result of this form when I send it should be ...
0
votes
0answers
6 views
trying to open a new window in HTML with window.open not working
I'm trying to open a new window when I press a button but my code is not working. I get the error "Uncaught SyntaxError: missing ) after argument list". I can't find what I am doing wrong
&...
0
votes
0answers
3 views
How to put timestamps within array in local storage?
Hello I am creating an chrome extension and I am trying to put all my timestamps that a retrieved after visiting a url into an array in local storage but I am having trouble doing so. It continues to ...
0
votes
0answers
9 views
navigator.onLine and online and offline eventlisteners not working
When I disconnect my wifi connection the offline eventlistener doesnt fire and the navigator.onLine returns true. It used to work before. In the documentation it says that "if the computer is ...
0
votes
0answers
8 views
Calculate checkbox enabled rows and display in another table angular
I have a two tables totally Table1 and table2. Table1 is filled with data from a service. In Table1 I have columns such as Qty,Price and Checkbox. In the checkbox columns I have checkboxes as values. ...
0
votes
1answer
13 views
How to modify elements in React in scope of an instance of the component
So lets say I have 2 instances of a Component and there I have few buttons which take their data from server.
But the thing is these instances might use the same object, I might have this code:
<...
0
votes
0answers
9 views
How can I make an iframe clickthrough to base html
I'm working on an iframe where I'm trying to overlay the iframe on top of a web page. The iframe is a floating button that remains on the bottom right of the webpage no matter where the user is on the ...
0
votes
0answers
3 views
electron get URL of local javascript file and return that
I'm trying to mimmick some behavior that is easily achieved in chrome extentions, right now my app is getting bigger and I'm trying to rebuild in into electron as a standalone app.
Sadly I'm Running ...
0
votes
0answers
6 views
Javascript and async problem (building distance matrix with yandex maps api)
I'm new to js and async/await stuff and I want to build distance matrix using yandex maps api and then optimize the route using ACO algorithm.
Everything works, but my distance matrix generating so ...
-1
votes
0answers
10 views
Display Dynamic data in reactJS application
I am working on building a web application using reactJS, we hit a service to get the data and display it on UI. We should display the products an user subscribed to, displaying each user per row. And ...
0
votes
0answers
3 views
Summernote Not Wroking With Datatables
I am New to Web Programming ....
I have a Problem With including Libraries , I Using Summer note (/*! Summernote v0.7.3 ) For Add Notes And I Using Data Tables And Bootstrap 4.5
<script src="...
0
votes
1answer
15 views
Iterating through list of <div> on keydown event by pressing down and up key
This function iterate through list of <div> on keydown event by pressing down and up key. Also when press enter key, <div> text content is inserted into the <input> field. I would ...
1
vote
1answer
16 views
Make a div be added to an element with the .add() jQuery method
I have this code that can create <div></div>'s that are draggable. I'm trying to make the draggable <div></div>'s be able to be dropped in any <td></td> and have ...
0
votes
0answers
20 views
remove gap in columns css grid
class UserControls {
constructor() {
this.sudokuTable = document.querySelector(".sudoku-table");
this.createInput();
}
createInput() {
let i;
let input;
for (i = 0; i < 9 ...
-2
votes
0answers
30 views
Algorithm For Numbering in JavaScript Separated by dot
I have a question to make an algorithm for numbering in javascript PHP.
So the format of numbering is like this.
For example, there is a people in the system who have an id:
adm01
and then there is a ...
0
votes
1answer
14 views
How to get MIME type of a text file without extension in Node.js
How can I get MIME type of a text file with no extension in Node.js? I am using file-type package, but it does not detect file type of text files.
Thanks
0
votes
0answers
15 views
Uncaught SyntaxError: Identifier '[x]' has already been declared - why?
I'm writing some recursive JavaScript code which also uses timeouts. The purpose is to wait a bit, execute some code, then call the function again:
function executeAIMoves(states, curStateIdx) {
...
0
votes
1answer
21 views
Print from nested array using map, reduce and filter in javascript
The final purpose is to get one for each name in the following array.
(Alike the commented out rows at bottom of below snippet)
If there is the same name, only the one with the largest count, and if ...
0
votes
0answers
7 views
Multer image autorotating from ios upload
I've created an express app and have added a simple user image upload using multer. Everything works great except when you access the webpage using an iphone and try to upload an image, the image is ...
2
votes
0answers
11 views
CSS - JS | Z-index blocks the functioning of the gif animation
I tried to create an on-hover gif animation in an image block using jquery.js and this javascript code.
/*------------------ gif.js --------------------------*/
$(function () {
$(".playgif"...
0
votes
0answers
6 views
?Remove a subString and replace it with another string a javascript using the indices?
For example, let's say I have a string called string = "67 + 134"
For example, I know you can use the string.replace('+', '-') function to remove a subString and replace it with a new one, ...
0
votes
2answers
32 views
For in python to javascript language
I have this line in python for list comprehension, however I don't understand much of this language, and I wanted to convert it to javascript.
the line is:
next = [ (i,j) for i,j in getValidMoves(grid,...
0
votes
1answer
24 views
HTML not displaying anything after a certain point in my JS file?
console.log("Hi World!");
document.write("hi <br />");
var str = "string type";
var intType = 0;
var boolType = true;
var arrayType = [];
var objectType = {};
arrayType = [1, 2, 3];
var ...
0
votes
0answers
19 views
Set price is select option equal to
This is the code for my project:
<!DOCTYPE html>
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
...
0
votes
1answer
23 views
How to concatanate html links and display them in div
In js file i have
vm.text= response.children.map(function (e) {
var html = '<a ng-click="hello">' + e.number+ '</a>';
...
0
votes
1answer
20 views
js use “Chain of Responsibility Pattern” but after export, all external calls are empty
I am trying to implement "Chain of Responsibility Pattern" with JS, but the problem I encountered, after exporting "chainController", all external calls got NULL. From the code ...
0
votes
1answer
10 views
(Javascript) why borderBottomRightRadius sets as borderRadius?
i have 5 inputs type range, when you use em, a image change its border radius property:
<div class="element" id="element">
</div>
<div class="ranges"&...
0
votes
2answers
25 views
Dynamically set getters and setters for a class
I can set a property of a class externally from a string value after it's been created like so
class Class {
//Nothing
}
let storageClass = new Class();
storageClass['value'] = 'Hello World';
...
0
votes
1answer
12 views
Unable to access API key in Heroku Config Vars from Javascript app
I am trying to deploy a simple static app consisting of HTML, CSS, and Javascript files to Heroku. I have added "dummy" composer.json and index.php files as well, to allow the static file to ...
0
votes
1answer
15 views
hook's state value not updating when passed as prop
Here is a code pen that I made that shows what I am trying to do.
https://codepen.io/doliphin/pen/JjRbqJO
From the local scope of each <Block />, they are able to access the value of all other ...
0
votes
1answer
15 views
How to perform calculation based on the form value
I have this code
<form>
<input type = "number" name="name1" value="">
<input type = "number" name="name2" value="">
<...
0
votes
1answer
25 views
class component not waiting for function to return
i have a function that pulls and sorts data from an api ( getactivity() ) and then returns the sorted data in the correct format ( answer1 ). but im running into a problem.. when i try to run to ...
0
votes
2answers
22 views
Way to include HTML code statically instead of in a live environment?
I am building a front-end website, no back-end code at all, since I want to host it on GitHub pages, and honestly adding any back-end would be overkill.
Is there a way to include common elements of ...
1
vote
1answer
17 views
Asynchronous command execution in Nightwatch JS
When I run the following code ...
console.log("0001")
browser.pause(5000, function() {
console.log("0002")
})
console.log("0003")
... the output is 0001, 0003, 0002. ...
0
votes
0answers
8 views
how to dynamically show messages react-router-dom
currently working on an api to display set of movies...i want it working so that when i click on a title it redirects me to a different page with the name of the title as the heading..i have already ...
0
votes
0answers
9 views
How can I call html function on click from Chrome console?
I'm trying to click on a row in a grid on https://www.geoguessr.com/results/eC24Umyej5bNAftC.
The first node has this button:
<div class="results-highscore__player-place">#1</div&...
0
votes
0answers
7 views
Checking the duplicate field value on the blur event of the dynamic field in angularjs
Add Car Name loads new input text with empty value;
Entering the duplicate car name gets validated against the list. But, the issue I am facing is the ng-model is getting the updated value/entered ...
0
votes
0answers
10 views
Shortest Path with several destinations
I am building code to determine the shortest path in a matrix where I can have more than 1 destination. However, the bot should find the first shortest destination and then move on from there (The ...
0
votes
1answer
20 views
Component gives error before api is able to fetch
So I have a react app that fetches data from an express server and displays it in a component called 'Articles'. The problem I'm having is that I get an error in my Article component saying data.map ...
0
votes
1answer
19 views
Javascript / Vue Executing a function after another (synchronously)
I need to run one function after another in VueJs
data: function() {
return {
stuff: '',
myArray:[
{
"id": 0,
...
0
votes
0answers
6 views
Javascript change <a> links to fancybox iframe popup is limited to 31 links only
I have strange problem that I can't solve.
I have a portfolio style page with small thumbnails and each thumbnail hyperlinks to another page on the same domain.
I have write javascript code to change ...
1
vote
0answers
17 views
How do I delete dynamic Vue components added reactively? [duplicate]
Let's say I have a Vue component that can create additional components through an array and v-for, like this:
<div id='vapp'>
<component v-for='obj in objs' :is='obj.is'></component>...
0
votes
2answers
16 views
Vue data being stored in vuex but not displaying in the UI
I am trying to get some plan data to show up in my Vue application. The data is loaded via an API I have running locally. I have figured out how to add the data to the store/vuex and vue dev tools ...
0
votes
0answers
15 views
How to handle a file upload of object that contains objects?
I use vue, express as my stack
For new order creation I have an object for example:
order:{
parts:[
part1:{
name: '',
image: null
etc...
}
],
variations:[
var1:{
...
0
votes
2answers
41 views
How do I reverse a filter in javascript?
How would I write a function "reverse" that would filter the elements not filtered by the original filter?
I feel like it should be simple but I can't think of a solution.
let f1 = e => e ...
0
votes
0answers
15 views
What is better performance wise for console log usage
I am planning on redoing all my errors in nodejs file to make them more useful, so I can see what is going on.
Therefore I was planning on taking it from this:
console.log("Example err:", ...
0
votes
1answer
15 views
Potential issue related to React hooks asked for job interview
So I have a React job interview and have this piece of code in my assignment to close and modal box:
const App = (): ReactElement => {
const [isOpen, setIsOpen] = useState<boolean>(false);
...
-1
votes
0answers
11 views
ToDo List with node.js and express
I have been trying to solve this problem for a week and all to no avail, this is my final test, which must be passed before tomorrow. All semester we studied mostly JS applicable to the browser. And ...
-1
votes
0answers
8 views
Javascript canvas games using modules
I'm writing simple JS canvas game and I'm at 700 lines of codes and I'm tired of scrolling and managing all this. I would like to have a few files for this, are Modules ES6 good choice for this?
0
votes
1answer
20 views
how to resize a HTML browser window with javascript using Chrome
I have a program where I place the element using CSS in % of window height and width. When opened in a monitor with different resolution (only if the ratio height-width is different), the elements are ...