Newest javascript Questions

Q&A for professional and enthusiast programmers

How to use Jasmine to test DOM manipulation?

I have a front end vanilla JavaScript application that I would like to test with Jasmine. I have set up grunt-contrib-jasmine and got some 'hello world' tests going. I am unsure how I would test DOM ...

Slide a div from left-right or right left with preserving div size

I want a slide effect on a div from left to right or from right to left as in $('#div').show('slide', {direction:'left'}, 1000); being my html is <div id="div-pre"> </div> <div id="...

Retrieve landline caller phone number to javascript application

I'm looking for a way to retrieve the caller phone number to a landline number to add them automatically to a list that is generated using javascript, any suggestions how to get this done?

AngularJS : angular-ui-router redirects to $urlRouterProvider.otherwise path When I refresh the page

I've an SPA with rails api on backend and angular as front-end framework. I'm using stateProviders, $urlRouterProvider for managing states in my SPA I'm facing a small problem with ui-router. ...

Angular routing error: should only include this file once

I am playing with tutorial Tour of Heroes found here. Everything runs and looks fine. However, after I added routing from root page to dashboard and to hero's detail, I got the following error in the ...

PHP code not running under script tag [duplicate]

<?php echo "hey"; ?> <script> <?php echo "hi"; ?> </script> Why isn't the php code inside the tag running? Thanks

Angular - jQuery Syntax Highlighter not working for nested view

I have an angular application and it working well. In on my nested views, I would like to display javascript source code. I found this tuto that is working on normal views, but When I try to implement ...

convert words to language ( english to Ukranian ) without translator

I am trying to find a solution most in javascript , nodejs or php in any of these what I want is to concert text or word to another language . example in english "iphone" most translator not ...

Playing/Pausing Music Using Javascript?

I've been working on code to pause and play music and I'm stuck because it works perfectly when the mp3 is hosted online (Dropbox) but when I tested it with a local file it doesn't pause, it replays ...

safari 10.1 es6 module example

To my surprise I can't find any demo pages that uses es6 modules to showcase safari 10.1 es6 module support So I made a index.html page with this in it <script type="module" src="scripts/index.js"...

How to load multiple types in Fancybox 3

I use Fancybox 3, this is how I load my gallery (I disabled opening/closing animation so I load it like this: $(document).on('click', '[data-fancybox-var]', function(e) { e.preventDefault(); ...

Any way to connect to a webpage, call JS functions, and then download the html using PHP?

I am trying to figure out a way to connect to a webpage, run JS functions on that webpage (Which will modify the html), and then download that modified html. I'm not sure it is possible this way, and ...

Vuejs how do you update model's data in model's method?

I'm doing a simple update in the model. when the button is click. it will update the data: message with "Good Bye!" and it work but it revert back to the "Hello Vue.Js!" right away. How do you change ...

JavaScript image gallery slideshow

I'm trying to make a simple photography website with a photo gallery slider navigation, but when I click to see the next image, the browser repositions to the top of the page. What am I doing wrong ...

JavaScript and GeoJSON - How to extract coordinates center and append city name

Say I have a big GeoJSON, containing a FeatureCollection, which consists of Features, which again is an array of Feature objects. Each of these objects is a city district as can be seen under ...

Passing props from container component to nested route component

How can i share state between AppContainer and Home component? For example, i want put results object in the state of AppContainer for pass it to all other components. In this app i'm not using ...

Facebook notification drop-down by angular

i'm trying to make notification drop-down like facebook , when the notification is unread the there's a status that's unread is true or false so i want to make the background color of this ...

why does a file downloaded from server above 32kb is automatically reduced to a size of 32 kb when I download it through sftp in node js?

I am trying to download multiple files from a server to my local in that according to my observation the files above 33kb were automatically reduced to 32kb and when they first get downloaded i am ...

Can't run meteor on windows 10

My issue is that i can't run the command : meteor. Whenever I try using this command inside a newly created project or from an existing project that I created from my other computer, the command just ...

How do I make a random quote appear as a Tweet web intent query parameters?

HTML Code <script> window.twttr = (function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0], t = window.twttr || {}; if (d.getElementById(id)) return t; ...

Display dropped link as an inner clickable div

<div id="dropzone" contenteditable="true"> </div> <style> #dropzone { height: 50px; width: 100%; border: 1px solid black; } </style> When I ...

checkbox property check value not updating in knockout js

I am working on Knockout Js. I have a page where I have three checkbox and its under foreach loop. Here is code <div class="form-horizontal" id="ko-bind-element"> <input type="...

jQuery - Parse JSON from multiple urls and append to multiple divs

I got a HTML list with 4 items (each item has their own id assigned). For each item in list, I'm trying to get JSON data from multiple urls using ajax, then parse the data to the item's id. Expected ...

Reset Bootstrap modal when clicking outside modal window

I'm having some problems with reseting my bootstrap modal whenever the user clicks outside the modal window to dismiss instead of pressing the dismiss button. My datetimepicker stops working whenever ...

Get notified about manually clicked links in Selenium WebDriver using C#

I'm using the ChromeWebDriver together with Selenium. The application is partically controlled automatically. Now I want the user to navigate to a page, where he has to choose a link from some list ...

Ionic 2: access main page's services from popover callback

I've been on angularJs for a while now and I just switched over to angular 2. I'm calling a popover from a page and when an item is selected from the popover, I'm supposed to get some data from an api....

using cryptojs to generate RFC 2104-compliant HMAC with SHA256 algorithm

im am following this amazon documentation in an attempt to find the algorithm to generate a signature in javascript. I cannot seem to get it to work. // html // <head> <script src="https://...

why my javascript code doesnt behave as I expect

The if statement doesn't work, it goes to the else statement, even though the colors match Can you please tell me where's the bug? var colors = [ "rgb(255,0,0)", "rgb(255,255,0)", "rgb(0,255,0)", "...

JS in node-red : Arrays, Objects, and how to get to them

I have a function node: PoolVarAuto = global.get('PoolVarAuto'); PoolVarPump = global.get('PoolVarPump'); msg.payload = [{'var':'PoolVarPump', 'val': PoolVarPump} , {'var': 'PoolVarAuto', 'val': ...

Since updated angular 2 version, requests are getting cancelled

so since i updated angular 2 and more few packages by npm, some of my requests are just getting cancelled if i send multiple request at the same time, for example if have loop of some groups, and i ...

Bind a function to another window?

Let's say there's a function in the top window. For example: function z() { alert(window.name); } Let's also say there's an iframe in this document (same origin). Can a function in the top window ...

How to set collision between player and tiles? Phaser

Here is my code: var Main = function(game){ }; var velocityOfTileMoving = 10, speedOfTileGenerating = 15000, speedOfPlayerMovingRightLeft = 150, facing = 'left', sizeOfPlayer = 0.5,...

502 Bad Gateway when deploy node.js app with Google App Engine

I'm deploying my node.js app with Google App Engine. But It gets error 502 Bad Gateway. I deployed my app following this step. Go to Google Cloud Project console Open Google Cloud Shell ...

JQuery Parallax effect. OnScroll event very Laggy

I'm trying to make a simple Parallax effect in js. There is my code: function parallax(){ $(".parallax").css("backgroundPosition","50% "+$(document).scrollTop()+"px"); } parallax(); $(window)....

Lock typing letters on the keyboard in JavaScript

I have an input (type text) and I want lock typing letters, only numbers (you know: 0, 1, 2, 3, ...) but I don't know how I can do it using plain JavaScript (it is important, I don't want use jQuery). ...

Javascript - Three.js material and shadow

I was wondering what I did wrong with choosing mesh material. As you see: The black ones looks fine the shadow is smooth and correct. However, if you notice, the white ones look strange and the ...

Create CRUD with modal datatables

I'm a beginner for coding. Now i want to make CRUD datatables with modal. I've tried but it made me more confused. So i ask help to someone for create a sample code for create update and delete data. ...

Transform JSON Data into a timetable

I have an API that is a large JSON file from a URL, what I'm attempting to do is create a timetable out of it. I've gotten as far as being able to print certain sections of the JSON file but I can't ...

VueJS how to replace dispatch with emit

I want to send a signal from a child component to a parent. I don't want to use Vuex as for my level of VueJS knowledge Vuex is too complicated. I am using single file components. child.vue <...

Bind on C++/CLI delegate in Javascript (WinJS)

I am building a Cordova application for all major operating systems (iOS, macOS, Android and Windows). I wrote a native Plugin (WinRT) in C++/CLI to call some native functions, this Plugin uses ...

how to turn off watermark on wonderplugin carousel

I am using the wonderplugin free version on my website and I would like to get rid of the wonderplugin link in every alternate image. How can I turn it off? I have tried changing a bunch of codes but ...

Javascript requestAnimationFrame - HowTo stop program running and wait until drawn?

I wrote a small program in javascript where a person is basically moving over a field hunting mushrooms, after every move (N,E,S,W) i want to redraw the whole canvas and i also want to see it on my ...

`chrome.tabs.onUpdated.addListener` event returns strange results

This is the code I'm trying on background.js: chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { alert(changeInfo.url); }); I'm trying to trigger this event and show the new URL ...

I need to create js script on faceboo console without api

I need to create a script that will be inserted into the console of the facebook page. After that, this script should add preprogrammed posts to the news line. The idea is to randomly add the pre-...

Refactoring legacy mixin-based class hierarchies

I'm currently working on a huge javascript project which has a huge class hierarchy and heavily uses mixins to extend functionality of base classes. Here is an example of how mixin looks like, we're ...

I need a simple 20 minutes timer in php it should be good looking [on hold]

Hello guys i am new on en.stack.aiseen.org,i am a beginner in php and i am making a project in php for a dynamic quiz with database and stuff.So now i need a countdown timer for about 30 minutes it ...

In JavaScript, if multiple spaces are added between two strings why they get converted to a single space during code execution? [on hold]

While learning JavaScript I come across one issue. When I add multiple spaces between two strings, all spaces get converted to a single space. I tried to add multiple spaces between two strings with ...

Accessing properties of elements of an array which are objects in javascript [on hold]

I'm trying to access elements of an array which are objects in javascript. I can access the properties of the object and print them to the console in two different ways. Which way of accessing is ...

jest - setTimeout not triggering when unit testing

I have a component that initializes a setInterval method in order to trigger a countdown using state. I would like to test this method by using a setTimeout function in my unit test, but the ...

How to putform data into json file in Angular 2

I want to put form data into JSON file after submitting and validating form. I am getting the object but I can put it. Here is my code. onAddSubmit() { const data = { institution: this....
Translating... 0%