Category "javascript"

e.preventDefault() not working in 100% cases

I'm trying to disable every click events on a web pages. document.addEventListener("click", function (e) { e.preventDefault(); e.stopImmediatePropag

Stop swiper slide autoplay on mouse enter and start autoplay on mouse leave

How to stop swiper slide autoplay on mouse enter and start autoplay on mouse leave? I have tried .stopAutoplay() and .startAutoplay() function but not worked fo

use distinctUntilChanged on objects

How can I have distinctUntilChanged work with objects like this myObs = Observable.from([{foo: 'bar'}, {foo: 'bar'}]); myObs.distinctUntilChanged() .subscri

How to update a variable that depends on another variable in a function?

In the sample code below, note that the value of the variable dependent depends on the variable prereq. When the function changePrereq is called, it changes the

Checkmarx scan - how to fix Missing_HSTS_Header warning?

after running Checkmarx scan on my Node.js application, I got a warning of Medium severity -> Missing_HSTS_Header. On this piece of code that just returns th

searching multiple Object Value in another Object JavaScript

I have 2 array of object in that, I want to compare all of the first array object property and value present in the second array of object. (at the object level

searching multiple Object Value in another Object JavaScript

I have 2 array of object in that, I want to compare all of the first array object property and value present in the second array of object. (at the object level

use distinctUntilChanged on objects

How can I have distinctUntilChanged work with objects like this myObs = Observable.from([{foo: 'bar'}, {foo: 'bar'}]); myObs.distinctUntilChanged() .subscri

AngularJs - Reducing Image Size while saving in database

In my Angular application, I have browse and upload image functionality. Sample images provided by Windows7 (Chrysanthemum.jpg, Desert.jpg etc) having sizes gre

Disable right click on pdf inside embed element

I have an embed element in which I provided path to pdf file. I want to prevent it from being download. <embed src="test.pdf" width="760" height="800" oncon

Material UI Select component crashing React application

I'm trying to add a material ui select component to the React application I'm working with. When I try to add a select functionality to a form, it crashes. Desp

How do I prevent the input of a number like 2.2.2 in my calculator?

I have been working on a simple JS calculator using an OOP approach. I am struggling to create a fix that prevents the input of extra decimals. For example, a u

Disable right click on pdf inside embed element

I have an embed element in which I provided path to pdf file. I want to prevent it from being download. <embed src="test.pdf" width="760" height="800" oncon

How do I prevent the input of a number like 2.2.2 in my calculator?

I have been working on a simple JS calculator using an OOP approach. I am struggling to create a fix that prevents the input of extra decimals. For example, a u

How to remove the first property of an object?

How do I remove the first property of an object like: var obj = { x:1, y:2, z:3 }; so that obj becomes: { y:2 , z:3 }; This approach doesn’t work

Firebase serve error: Port 5000 is not open. Could not start functions emulator

I'm trying to serve firebase functions locally, but when I run firebase serve or firebase emulators:start the error message is: "Port 5000 is not open, could no

How to remove the first property of an object?

How do I remove the first property of an object like: var obj = { x:1, y:2, z:3 }; so that obj becomes: { y:2 , z:3 }; This approach doesn’t work

How to select individual bars in d3 bar chart and highlight the selected bar?

I'm trying to select each bar in the bar chart by adding a click event, but in my code, highlighted bars are disappearing when selected. Please refer to my link

How to select individual bars in d3 bar chart and highlight the selected bar?

I'm trying to select each bar in the bar chart by adding a click event, but in my code, highlighted bars are disappearing when selected. Please refer to my link

How can I validate the file type selected from an input element of type file

I am trying to allow users to upload an image by using the html below <input class="file-upload" id="imagepath" name="imagepath" type="file" accept="image/x