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).
1,903,726
questions
0
votes
0answers
3 views
Why do Firefox and IE not refocus an already opened tab by window.open
I'm opening a new tab with a button that calls
window.open("https://www.w3schools.com/", "w3tab");
When I call this method the first time the tab is opened and focused.
When I call it the second ...
0
votes
0answers
5 views
Undefined for a Select List when used in ngForm
I'm an Angular beginner and I'm trying to print values of form elements selected in console. Every other element like got printed but the select selected list element shows undefined. Here's my code
...
0
votes
0answers
4 views
how to select browser tab for that opened current tab in javascript
I have a web page with a link that opens another page in a new tab. In the newly opened page, I have a link that, when clicked, should bring focus to the original tab. I thought this should work:
<...
0
votes
0answers
4 views
How to incorporate my podcast rss feed on my personal website?
I have a podcast host (anchor.fm) that submits my shows RSS feed to all streaming services like iTunes, etc.
I would like to have that RSS feed on my website which updates as I upload new shows to ...
0
votes
0answers
6 views
Syntax error, unexpected WHEN, expecting $end - I dont understand why?
I am using QGIS 3.8 and I am trying to add in stles to selected polygons.
The code draws information from other columns to create a new column within the attribute table, however I am getting the ...
0
votes
0answers
10 views
how to call and return data from API with AJAX?
Im trying to call an API using ajax.
The api is https://rapidapi.com/brianiswu/api/genius?endpoint=apiendpoint_d2f41ea4-7d5c-4b2d-826a-807bffa7e78f
I cant make it work.I searched in internet but i ...
0
votes
0answers
3 views
ParksController#create is missing a template for this request format and variant. request.formats: [“text/html”] request.variant: []
I'm creating a park with a modal. Everything seems to work fine when I'm not saving a picture in the form. When I do add a picture and try to create/save, the picture gets saved, but I get an error ...
0
votes
2answers
34 views
How would I get this function to only return three numbers? [duplicate]
**<script>
function computeGrade() {
var cg = document.getElementById("cg").value;
var dg = document.getElementById("dg").value;
var wof = document.getElementById("wof").value;
var ng = (dg - (...
0
votes
0answers
14 views
Doubleclick event not working in mobile browser view
i created a double click event on a div , when i click twice a heart react appears on top of the image , on the web browser vue it works fine but when i pressed F12 and switched to mobile view it didn'...
1
vote
0answers
12 views
Removing class does not stop keyframe animation in IE11
The snippet below shows a simplified example of an issue I have found with css animations in Internet Explorer 11.
The spin button adds the '.spin' class to the div, which should change the banner's ...
0
votes
0answers
17 views
Print Json data in html table
I am working on this problem in which i am printing json data in html table. I have tried nearly i know but failed. What i want is to print the User_info-> data present in JSON file into my html table ...
0
votes
2answers
21 views
Vue, passing multiple arguments/params into function
I'm trying to use a link to call a vue function with 2 arguments/parameters but it doesn't seem to work, though it was previously working with only one.
I have:
<td>
<a @click="delete('{{$...
0
votes
0answers
12 views
Request to API with nested JSON
I need to make a POST request to a WebAPI with a nested JSON body.
Unfortunately, I'm inexperienced in accessing WebAPIs and don't know how to do it (or how to find out if the WebAPI supports this to ...
0
votes
0answers
8 views
Load CSV file from user's computer into variable using JS or jQuery
I have a simple page built with HTML and some JS scripts only (no backend).
I have placed all the files within one directory, including a csv file:
index.html
style.css
scripts.js
data.csv
There ...
0
votes
3answers
23 views
What does the “?” operator do in Javascript? [duplicate]
I am wondering what this question mark symbol means in a function return statement in JS.
function getValue(val) {
return (val != null ? val.toString().replace(/,/g, '') : "");
}
0
votes
2answers
27 views
Closing menu by clicking outside
I've got small menu, which I want to automatic close on clicking anywhere on the page. I know it's probably a matter of adding one line of code, but everything I've tried so far doesn't work...
Now ...
0
votes
1answer
14 views
JavaScript / Jest: How to show logs from test case only when test fails?
I'm working on an end-to-end test suite using selenium where the test cases are written in JavaScript using the jest test runner.
My problem is that selenium often fails unceremoniously when ...
1
vote
0answers
17 views
Why is my hover state in this memory tiles javascript project not working?
I am trying to add a hover state to this memory tiles project on Khan Academy. I believe I have inserted the correct code at the bottom to change to color of the tile, but when I test the code it only ...
0
votes
0answers
5 views
Using AEM's Javascript Use-API, how can I pass a function to the HTL side and invoke it with arguments?
In Adobe AEM, say I have a Javascript Use-API file with this data being passed back:
File: secure.js
use( function() {
var pages = ['home', 'about', 'contact'];
return {
pages: pages,
...
0
votes
5answers
46 views
How can I reduce an array of objects depending by an id
expected output:
[{id: 1, atributo: {id: 20}, valor: 1753,96},
{id: 2, atributo: {id:21}, valor: 1520}]
I have this array of objects:
myArr = [{id: 21852, atributo: {id: 20}, valor: "876.98"},
{id:...
0
votes
0answers
9 views
I load the full jQuery library, but I only use Ajax and selectors. Better shorter code?
I created a star-rating voting system based in jQuery, I load the full jQuery JS library, but I found that I only two features of it:
the simple Ajax method: $.ajax({url:"dosomething.php",cache:0,...
0
votes
0answers
27 views
How can I resize image to fit container height on button-press?
So I'm trying to tweak my Anki flashcards by adding stroke-order diagrams for kanjis.
The diagrams are generated by a plugin called Kanji Colorizer.
Love the plugin, but the images are
are too big
...
-4
votes
0answers
17 views
How to make a sticky sidebar like reddit.com/Facebook
I want to make a sticky sidebar like reddit.com/Facebook.
I already read so many article in this site.
Such as this one
But this sidebar is not what I need, It should be responsive like instragram....
0
votes
0answers
20 views
Why my selecting checkboxes on loading doesn't work?
I'm trying to set a checkbox based on the corresponding field in the DataTable. The code below prints the values in the table and the respective checkboxes connected to the Id, in this case the ...
0
votes
0answers
7 views
Cloudinary nodejs Delete
in my nodejs Postgres API, i'm trying to delete an image from cloudinary. This image, it's url and it's public_id are saved in my db . This is the code: so what am trying to do is, get the public_id ...
0
votes
1answer
11 views
How to automatically add intermediate structure to a nested Object (à la Python's defaultdict)?
I would like to automatically add intermediate properties when creating a nested Object:
let a = {}
a.hello.world = 1
This raises an error (Uncaught TypeError: Cannot set property 'world' ...
0
votes
0answers
7 views
Dynamically Rendering MapView Marker React Native
This is how my Map View Looks like :
<MapView
style={styles.mapStyle}
initialRegion={{
latitude: 51.524300,
longitude: -0.037790,
...
0
votes
0answers
11 views
How to order nativescript texttospeech messages?
How to make promises work? TTS just reads last await.
First message must be the first playing message then, after a pause, second message should start.
<template>
<Page>
<...
0
votes
0answers
11 views
How to position an svg properly aligned in between two divs using javascript or react?
i have an svg ,content box and popup dialog. now i want the svg to align properly next to the content box and the end of svg should be on top of the popup dialog. like in image below,
Now i want to ...
0
votes
0answers
14 views
issue while creating a dynamic dropdown box using multiselect jquery plugin
I am trying to make a dynamic select dropdown, I tried writing the code in javascript and jquery both but can't append the options in the dropdown. When I tried seeing what is stored then the Html ...
0
votes
0answers
10 views
Is it possible to poll an Ajax patch call to see if it was successful?
I have 2 Ajax calls that are attached to my Kendo ui grid, one that sends a patch or updates data, and one that gets data. On page load the get data call is executed first. Then the user can select ...
1
vote
3answers
25 views
Change Text size to avoid scroll when container size changes
Is there any library or best approach to make text inside container visible by changing the text size of the text when container width or height changes.
-1
votes
1answer
34 views
How Wrap every two element with a div
This is my HTML
<form name="contact-form">
<label>Name</label>
<input class="contact-name" type="text" value="">
<label>Email</label>
<span>*</span>
&...
0
votes
0answers
19 views
Dropdown display issue when sticky positioning within a table
Hoping for some insight on a problem I have run into.
I have created a table where the last column is fixed right using position: sticky. This works perfectly, except when using dropdown menus from ...
0
votes
0answers
10 views
How to protect chartJs gradient colors from window resizing
I applied some gradient rule to my chartjs chart.And it looks great as you can see on the below
But when you small the width of browser as you can see on the below its being spoiled (Bottom blue ...
0
votes
0answers
12 views
Cannot show carousel in carousel modal
I'm trying to use lightslider inside a Bootstrap modal, but until now I didn't have success. Infact, for some reason the carousel with all the images doesn't appear. This is my code:
HTML
<button ...
0
votes
0answers
13 views
How to handle a new window in selenium when I opened it by javascript
Using selenium in internet explorer I have opened a new window with javascript code:
((JavascriptExecutor) driver).executeScript("windows.open('www.google.com')");
When I try to move to that new ...
0
votes
0answers
17 views
set async variable inside promise [duplicate]
I have an objective to map through a list of json files, and map them into objects and return them in node.js, so far i have this code.
function getDirFiles(dataFolder) {
return new Promise((...
-1
votes
2answers
25 views
regex for appscript, case insensitivy not working [duplicate]
Below I am trying to use regex to get the occurrence of certain strings.
var value = "ab-2123 AB-332";
var regExp = new RegExp("(ab)[-][0-9]*", "gi"); // "i" is for case insensitive
var ...
0
votes
0answers
15 views
I want to make single cronjob and calling two differnet URI and different timings also
In Crontab.js file i have
var request = require('request');
require("../config/config.js");
var ACE_HOST = CONFIG.API_SERVER_IP + ":" + CONFIG.API_SERVER_PORT;
var pendingHomeWork = function(){...
0
votes
1answer
25 views
What is the ultimate toggle of this fold/unfold state?
I've posted a question with the same code but this is a different question. Here is the jsfiddle and bigger preview.
So this #li.active inside #sidebar is foldable. When the list is toggled to be ...
0
votes
1answer
21 views
jQuery - Failed to execute 'getImageData' on 'CanvasRenderingContext2D': Value is not of type 'long'
I have a video and canvas element like so:
<video id="video" width="640" height="480"></video>
<canvas id="canvas" width="640" height="480"></canvas>
and what I am trying to ...
0
votes
1answer
22 views
Why do i get error in where clause on update mysql
I'm getting an error about Unknown column 'CR0001' in 'where clause' and I don't know why because the where clause it's about id_scooter column not cr0001. Here is my code
var update = "UPDATE ...
2
votes
1answer
28 views
Why constant variables for selecting DOM elements? [duplicate]
Is there a reason as to why we declare the variables as constant while selecting elements from the DOM? I see a lot of devlopers and tutorials use
const form = document.querySelector('form');
0
votes
1answer
32 views
Passing user and password to a redirected page in JavaScript
I want to redirect the user from a web page to another one that is password protected. Because the user comes on the first page scanning a barcode using a specific terminal (think to it as a ...
0
votes
1answer
40 views
I have object but cannot save all item from this object first object only can saved
I have object but cannot save all item from this object first object only can saved.
First interface:
export interface PhotoToCreate {
albumName: string;
albumTitle: string;
...
0
votes
0answers
15 views
How to check if an element is partially visible after scrolling past it?
I want to trigger a React.GA event after someone scrolls past a particular form.
I added this line to my componentDidMount
window.addEventListener('scroll', this.onScroll);
and then I have these ...
0
votes
1answer
25 views
Array change value by index duplicate issue?
I want to update value of my array of object for matching "key" the find index is working good but it's actually pushing the value instead of replacing it ??!
this.state.data = thedata Array [
...
0
votes
0answers
25 views
Use twitter API to extract tweets Javascript
I am trying to use the Twitter API to extract tweet updates from a user on twitter.
Here is how I am proceeding:
I am using this script to request the user JSON file and use it in the callback ...
0
votes
1answer
25 views
Loading JS libraries and using them right ater they are loaded
I am looking for a clean way to use libraries (such as jQuery, Knockout) in my HTML document.
In order to do that, I include links to CDN or to downloaded libraries in <script src=... element.
...