Questions tagged [javascript]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). This tag is rarely used alone but is most often associated with the tags [node.js], [jquery],[json], and [html].

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

Uncaught TypeError: Cannot read property 'out_of_community' of null in jquery

i am new in js i got data from json like var t = 0{ a = 1, b = 2, c { d=0, } } 1{ a = 11, b = 21, c { null } } then i am fetch data using like this t.a; i got data t.c i got [...
0
votes
0answers
3 views

NetworkError when attempting to fetch resource Passport ReactJS and ExpressJS : CORS

I have a front-end developed using React JS (http://localhost:3000/) and my backend using express JS (http://localhost:5000/) google Console details React Login page : on click of login using Google ...
0
votes
0answers
6 views

Convert SVG to DXF in JavaScript

Is there a way to convert a SVG to DXF using React? My SVG looks like this: <svg xmlns="http://www.w3.org/2000/svg" class="svg" id="svg" width="1068" height=&...
0
votes
0answers
6 views

Relationship between vendor.js and application.js in Webpack

I'm just starting out in Webpack/ES6 and trying understand the relationship between a vendor.js and an application.js file. Based on what I've read online, a vendor.js is a good place to import ...
0
votes
0answers
7 views

compare date entered in textbox with javascript

asp.net Code: <div class="form-group"> <label class="control-label col-md-5">Expiry Date</label> <div class="col-md-7"> <...
0
votes
0answers
5 views

How to modify grouped arrays in React

I'm fetching data from firestore and put it in a component state and pass it to a child component with props. A doc looks like: { id: "fFBMMEKbKJLtOjmk3jrV", eId: "...
0
votes
0answers
5 views

Delete DataTable rows in Shiny app using Javascript

I'm trying to remove rows from a Datatable in a Shiny app using Javascript. In the table I have a column with a "delete" button for each row. This would be more or less what I'm trying to do,...
0
votes
0answers
22 views

sound playing when I increase the volume

At first I set the volume to 0. How can I get the sound to play when I increase the volume with range? i get this error when increase the volume: The AudioContext was not allowed to start. It must be ...
0
votes
0answers
8 views

Using p5 library and the CreateCanvas function, how can you make the canvas create inside a div class?

How can i place the canvas inside a div tag? It always creates at the bottom of the body in the html and i want to put it inside a div. function setup() { createCanvas(400, 400); audioContext = ...
0
votes
1answer
19 views

How to set a value to a variable inside ternary

Is it possible to set the value of a variable inside a ternary based on a state change? Something like: { this.state.change ? myObj.changeIt = true : null } writing it like this returns an error: ...
0
votes
0answers
11 views

css allow div to scroll anywhere, but pan with Hammer if at the top

First i would describe what I'm trying to achieve: Basically I have a simple scrollable div as a container. But once it is scrolled to the top, I want the entire div to be pan-able (eg. to swipe the ...
0
votes
0answers
6 views

How to use window.__tcfApi() to get getTCData ? (tcf v2.0 , Prebid.js)

I am using prebidv4.8 and I am trying to upgrade tcfv1.1 to tcfv2.0. I have the following code for tcfv2.0: (function () { const makeStub = () => { const TCF_LOCATOR_NAME = '__tcfapiLocator'; ...
-1
votes
0answers
6 views

REACT, JS - how to achieve scrolling to sections with backslash instead of hash in url but working also on refresh/manual url type

I am building my first ever REACT app and it's gonna be one-page with scrolling to sections portfolio. I was able to get my links to have no "#" and have "/" instead but the ...
0
votes
0answers
21 views

nodejs async await does not wait in test

I've a nodejs jest test and it fails because it does not wait Promise. it('returns an error if the ticket is already reserved', async () => { const ticket = Ticket.build({ title: '...
0
votes
0answers
13 views

URL HTTP Encoding

I am new to php and I wanna use HTTP request to do the following. I want to fetch these information from database  table:110 room:602,603,604   name:John Encoded it in url so it will look like this  ...
0
votes
2answers
19 views

scroll to the bottom of a div in Firefox

I used var items = document.getElementById('messageBody'); items.scrollTo(0, document.getElementById('messageBody').scrollHeight); where, 'messageBody' is the id of the div with height 400px and ...
0
votes
1answer
15 views

Is it agains the convention to use `Vue.nextTick` in the Vuex mutation? May it break something?

As far as I know a mutation in Vuex should be synchronous. Vuex.nextTick ends up being asynchronous if I understand it correctly. Does it make it agains the convention to use it in the mutation then? ...
-2
votes
1answer
21 views

Get data from sub array in another variable [closed]

I have this array : [ 0 => { id: 1, name: 'Test 1', clients: [ 0 => { id: 100, name: 'Client 1' } ] }, 1 => { id: 2, ...
0
votes
0answers
10 views

Javascript Thread Safe

I have a buffer: websocketbuffer = [] Client event from html: <button type="button" onclick="buttonClicked()"></button> <script> function buttonClicked() { ...
0
votes
1answer
9 views

How to render an img in html with jspdf

I want to convert my web page to pdf, but having a jspdf image does not render the web for me, it leaves my screen blank and I get the following error: jsPDF Warning: rendering issues? provide a ...
0
votes
0answers
9 views

Error: error:0909006C:PEM routines:get_name:no start line, reason: 'no start line', code: 'ERR_OSSL_PEM_NO_START_LINE'

const rsaWrapper = require('./rsa-wrapper'); // generate opened and closed keys for browser and server rsaWrapper.generate('server'); rsaWrapper.generate('client'); console.log('Keys generated …'); ...
-1
votes
1answer
13 views

display the values as per the priority in reactjs

I have two array of Objects,array1 and array2. I can only show three values from both the arrays but priority is given to the array1. Requirement is, if array1 contains 3 elements, then show all the ...
0
votes
0answers
10 views

Get data from Google Analytics

I'm trying to get data from Google Analytics with Javascript, but the sign in button is not showing. I'm following all this steps: https://developers.google.com/analytics/devguides/reporting/core/v4/...
1
vote
1answer
21 views

TypeScript: Can you define a return Type structure based on an argument of the function?

I'm trying to create a function that will take a string argument and return an object that has this string as a key. for example (pseudo code): test('bar') => {bar: ...} I'm not sure how to get the ...
0
votes
0answers
13 views

A script with type=“text/babel” isn't executing or being requested by chrome, but it works as a “text/javascript” file

I'm trying to learn react and have this simple template from the getting started guide: <!DOCTYPE html> <head> <script src="https://unpkg.com/react@16/umd/react.production....
0
votes
1answer
28 views

Range Filter by within array of object

I want to make shift parser helper which is generate time of work shift, below is shift rule let shift_rule = [ { shift: '07-12', start: 7, finish: 12 }, { shift: ...
0
votes
0answers
10 views

How to select multiple checboxes after javascript autocomplete event click?

I've created a textbox with Autocomplete Javascript event from this tutorial : https://www.w3schools.com/howto/howto_js_autocomplete.asp (I'm using pure Javascript, not jQuery) and also I've created ...
0
votes
0answers
17 views

How to merge two duplicate object in an array using javascript? [duplicate]

i am trying to convert a json structure to some diffrent structure using javascript. here i am trying to make json with unique city name and value with total city. I don't want to use group by Ex: In ...
-1
votes
0answers
7 views

how to socket.emit a variable using socket.io

So how can you Socket.Emit a variable from a NodeJS backend. The variable has to change about every 1 minute so it needs to refresh often, would socket.io be good for this?. Thanks
-1
votes
0answers
11 views

How to enable CORS from frontend in github jobs api? [duplicate]

This is my code where I am making get request to github jobs api const url = `https://jobs.github.com/positions.json/?description=${description}&location=${location}&full_time=${fullTime}&...
0
votes
1answer
16 views

The resource was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: > nosniff)

File structure index.js: app.set("view engine", "ejs"); app.use(express.static("public")); app.use( bodyParser.urlencoded({ extended: true, }) ); chat.ejs <...
1
vote
1answer
22 views

How to structure nav element correctly?

I want to make a top bar on my webpage with menu elements in it. When you click one of the main menu options a new under menu will appear. So I wonder how is the correct semantic way to code this, so ...
0
votes
0answers
9 views

Data Table print view of a collapsed table row

I have created a table with collapsible row, where another table is displayed when is row expanded. Now, when trying to take the data table print it is displayed as(image1):Print View I want the print ...
0
votes
0answers
14 views

SyntaxError in asyncToGenerator.js after building and deploying reactjs code on google's app engine

Upon trying to send login details to the backend, I get this error message in console: Uncaught (in) Promise SyntaxError: Unexpected token < in JSON at position 0 asyncToGenerator.js Please see ...
0
votes
0answers
18 views

Angularjs - show/ hide table row on check of radio button

So, My problem is I have a table which renders from an Array of objects, Firstly, rows with data loads which has nested rows. On user selection of any row - another nested row should load and all the ...
0
votes
1answer
11 views

Can't disable the title select2 in 2 modal

I have 2 modal at same page using select2. I need to remove title on hover select2 in modal select form. I have tried $('.select2-selection__rendered').hover(function () { $(this).removeAttr(...
0
votes
0answers
35 views

Html table add column with javascript

I am obviously very new to JS. I need to solve a problem where i can't change the HTML and CSS-file. From the HTML-file I am supposed to: add a column with the header "Sum". (Already did ...
-2
votes
0answers
21 views

How to restrict URLs only start with https:// or http:// not starts with www.abc.com [duplicate]

How to restrict URLs only start with https:// or http:// not starts with www.abc.com i am using below code it returns true if i starts with WWW. also. var re = /^(http:\/\/www\.|https:\/\/www\.|http:\/...
0
votes
0answers
19 views

How to use foreach() when Array.forms error occurs?

I have this table created from API --> Table screenshot Need to take all elements from first column (ProtocolNo) and change it into link. When tried to use Array.from i get an error: error TS2339: ...
-1
votes
0answers
10 views

Restrict users from subdomain in multisite wordpress

i am using Multisite wordpress and i have a main public page (example.com) that the users can sign up . one new site is creating for them (sub1.example.com sub2.example.com sub3.example.com ,,,,,,). ...
0
votes
0answers
8 views

Remove component tag in StencilJS

I'm trying to remove the called component tag from HTML to prevent some broken CSS from external libraries and just show the inner content. something.component.html <div> Hello World </...
-1
votes
0answers
8 views

How to match keywords that are not in both single and double quotes using Regex? [duplicate]

I am trying to create my own Syntax highlighter but I am unable to filter keywords that is not in both single and double quotes. Actually I can do it separately but I don't have any idea how it's ...
-3
votes
0answers
13 views

how to draw a flow like Jenkins pipeline graph using Javascript? [closed]

I'd like to draw graph like following picture using Javascript, Html, CSS, how can I do that?, I googled a few hours, not found any existing JS library. Requirements: can draw a graph using SVG or ...
0
votes
0answers
8 views

LitElement infinite scroll reposition issue

I'm creating a POC for a LitElement infinite scroller that limits the DOM count of the list. The component is based on this one: https://medium.com/walmartglobaltech/infinite-scrolling-the-right-way-...
1
vote
1answer
17 views

Javascript Detect Whitespace and Count character length

I am trying to create HTML Text area input with some rule : if the length of character text input = 6, it will automatically create new line (new line from character number 7). But if in those first ...
0
votes
2answers
20 views

CanvasJs chart not rendering

my chart is not rendering. can somebody help me with this one ? when i load page, it only shows white background.. idk how to debug this anymore. need help <!DOCTYPE HTML> <html> <...
0
votes
1answer
28 views

Variable is empty in child component, VueJs

When an event is triggered, I call a function that fills a variable and opens a modal from a child component. But, there, my new variable is empty, and if I close/re-open modal I have the data, so the ...
0
votes
0answers
4 views

Openlayers CQL filter to show feature points but not remove previous?

I am trying to select all customers from my list to show on the map using cql filter IN function. the problem is that i am selecting customers asynchronously 500 hundred after 500 hundred when cql ...
0
votes
3answers
27 views

The localStorage property does not store hyptertext reference property of an element

The localStorage property (localStorage.setItem('theme', element);) does not store the href property of an element (element.href = '../assets/css/syntax-highlighting/synthwave-84.css';): const ...
0
votes
1answer
26 views

React: render an array where some elements are regular strings, others are <Link> components

I have a JSON object with a property content which is an array. Some elements in this array are regular strings, and some of them are <Link/> components from react-router-dom. eg: ["String1 ...

1
2 3 4 5
41846