Newest javascript Questions

Q&A for professional and enthusiast programmers

Async await usage and error handling woes

Both try's print Promise { <pending> } and the second one has an Unhandled Promise Rejection Warning. I've had success just using Promises with .then and .catch, but there's some stuff I'd like ...

Using JavaScript variables inside laravel blade routes

I have a piece of View code that contains data from a '.get' request to Ajax. The .get request passes some PHP code to a controller which retrieves the results from a query and stores them in the JS ...

Erase/reset DOM and global variables with JavaScript

I'm writing an electron app, but it's a question about JavaScript/HTML5 in general. I want to load local content in a webview and then open iframes from particular remote resource inside it. ...

Passing all props to stateless child component

I know you can pass all a react components props to it's child component like this: const ParentComponent = () => ( <div> <h1>Parent Component</h1> <...

Javascript - Explicit decimal values separated by comma

I have a JavaScript and HTML form to make a different sums and multiplications. In general, the script works fine, but in some cases, it does not apply the decimal separator and does not display ...

How do I load a QWebPage using Pyside?

I am trying to use Pyside to render a webpage's JavaScript generated HTML, then use that html for webscraping. I started off using this quick example, but I can't get it to work. The problem is that ...

How to call javascript function inside jQuery

We have this tag with a javascript function in our HTML, <select name="My_Saved_Billing" onchange="Choose_My_Saved_Billing(this.selectedIndex)" > <option>Select</option> &...

Can't access a object property of an array element, inside a object in javascript

I have an array of objects inside an object. Why do I get the error 'Cannot read property fname of undefined' below? How do I fix it? Also, I'm new to javascript and would appreciate any styling or ...

How can I use Webpack to create separate versions of my react's index.html page within an iframe?

I'm working on a React app which resides within an application called PowerSchool, and I'm trying to create a webpack configuration that allows for both a development environment that relies on ...

Remove color which is present on top of Radio buttons

We are using below code to add circular background for an image. once we click on image , its working fine here but along with image, its adding background color on top of radio buttons once we click ...

jQuery: show/hide are instantaneous

I've one div that contains to other one: <div> <div id="card-container">....</div> <div id="wait-for-result-container" style="display: none;">...</div> </div> ...

Display image in modal window from HTML page

In my HTML I have several articles. Each article contains one image, and if you click one of them, a modal window appears. So my question is, how can I make the image from the article show in the ...

Nativescript {N} oAuth plugin - Retrieve User Facebook Data

Context I'm attempting to create an Android app with Nativecript using JavaScript. On the first page, it asks the user to connect with Facebook, and I intend to verify whether or not an account ...

How to display the specific days without clicking the submit button but when a start date is selected?

Here are the code for the start and end date functions of my two datepickers: <script> var dateToday = new Date(); $(function(){ $( "#startDate" )....

Is there any way to make an carousel with a box to call imgs in any wished order?

so i can write in box below any order i wanna and hit GO so that called pics make an carousel

Tracking active users with Socket.io and Firebase

I have Node/Express app for which I am trying to track active users. The app relies on an external API to issue and receive JWT tokens. These tokens are passed directly to the client, where they are ...

Angular 1.5 directive with one-way binding updates parent scope

I have a directive with an isolated-scope and one-way binding variable. yet when i change that variable in the directive controller it updates the parent scope as well. Example code: function ...

require('mysql') returns null in node.js

I am trying to connect to a simple database on my Linux server, but cannot seem to get it to work properly. My names_query.js file: var net = require('net'); var mysql = require('mysql'); var ...

vue JS not propagating changes from parent to component

I am pretty new to Vue Framework. I am trying to propagate the changes from parent to child whenever the attributes are added or removed at a later stage updated outside the component. In the below ...

Javascript - Image.complete is true, but returning false in Firefox when running real time

I have a function: function IsImageLoadable(URL) { var imageObj = new Image(); imageObj.src = URL; var x = (imageObj.complete); var y = (imageObj.naturalHeight); if ( (x === true) &&...

What slider can be used for this option?

slider img Recommend plugin to realize a slider. If it can be of similar examples. thx.

Google Map JS API does not load correctly unless refreshed in jQuery Mobile

I have an app testing website as listed below: Testing Site And the problem I am having is if you click "Map" at the bottom, when the page loads the zoom on the map is not correct, and it does not ...

Dialog plugin buttonlabels as image

Right now my code is: navigator.notification.confirm( data.message, // message onConfirm, // callback to invoke with index of button pressed data.title, // title ['No','Yes'] ...

DropDown like Flipkart using PHP

I am trying to make a dropdown menu as in FLIPKART for different proucts. But I am not able to do so. When I am running this file only then it is perfectly fine. But as I include it into any other ...

Javascript charts - click and drag a series through time (Y Axis)?

How would I create a chart to allow the user to click and drag a series through time (for modeling and experimentation). I want them to be able to drag it back and forth on the Y axis. This would be a ...

Why for loop not working properly [duplicate]

I am having some issue with the following for loop. It is not printing values as expected. Here's is the result it is printing. i is 3 i is 3 i is 3 Here is expected result i is 0 i is 1 ...

Calling multiple AJAX calls same function one after another

I have a load_graphs function which does a AJAX call creates a graphs. The load_graphs function needs to be called multiple times to generate period for different regions as given below. Even though ...

Google Analytics tracking on a single page

I have a landing page for an app that simply points to the google play store. http://www.bryantmakesprograms.com/scanables/ The page has the following code at the top: <script> (...

bootstrap collapse not retaining state after click event

I am using bootstrap collapse. I have set up 3 different panels and each panel has add button. When I click on the add button (panel 2) then page get refreshed and it doesn't retain its state and as a ...

getting php variable working with embedded javascript functions

at the moment my code is like this echo '<script type="text/javascript">'; echo '<audio id="player" src="../cdh/ba1.mp3">'; echo '</script>'; echo '<a onclick="playAudio();"&...

Stuck trying to visualize an easy update/delete method

I'm just stuck on some basic server/client synchronization stuff. So I've got events coming in from the server that turn into markers on a map. To prevent flickering I have to loop through each one, ...

How to execute JAVA code from JS in JSP

I'm working with Java Web at Netbeans 8.1, actually I'm working with AJAX in the proyect and this issue stops me: This is my JS function in JSP: $("#formAddFundo").submit(function(event) { /* stop ...

Add child object with value to existing javaScript object

I have an empty root object created in JavsScript: var myObject = {}; Now, I want to add a child object with a value: { "myObject ":{ "myChildObject":"FooBar" } } Seems simple ...

AngularJS Scope Update Requires Double Button Click

Controller: // Modal Controller app.controller("ModalCtrl", ["$scope", "$filter", function($scope, $filter) { var date = new Date(); var currentDate = $filter('date')(new Date(), 'MM/dd/yyyy'); ...

Check to see if child object exists in JavaScript object

In JavaScript, I am building an object. Inside a loop I need to check to see if the root object already contains a child object, and if not, I need to add it. childObjectName = this.name.split('.')[...

How to call Typscript method from Javascript callback method - Angular2

I am using angular2 my issue is that I am not able to call component method from javascript callback here is the code snippet. declare var OBI_CORE_FACTORY:any; declare var ObiDomain:any; declare ...

How to set Kendo Date Picker to date() - 365 at startup

I have MVC CS.html file fragment like this .... Using AngularJS,Kendo Date picker... How to set the date in my controller code (javascript) to today's date - 365 days? Thanks Tom

Semantic UI sticky menu

I am trying to sort out how the Semantic-UI site made their sticky side-menu here: http://learnsemantic.com/developing/customizing.html#introduction . The pinkish/purple one on the left that scrolls ...

slick carousel sync to select

I'm trying to sync a slick slider to an HTML select and having quite a hard time with it. Here is my code : $(function() { $('.slick-slider').slick({ slidesToShow: 1, ...

Exporting npm package to allow for relative path import

I'm trying export a private npm package I've got, which splits out the builds into separate ones. The structure looks like this: build/ build-1/ index.js build-2/ index.js index.js The ...

element.remove doesn't execute after success $http call

I'm using a directive to check if the user has the right role to view a certain element. This is my directive : angular.module("BlurAdmin") .directive('restrict',restrict); function restrict (...

How to catch OPTIONS method call

My API is down right now, and my app crashed spectacularly due to the OPTIONS call getting a 503. After searching high and low, I've discovered it is very hard to Google "Catch failed options call", ...

Try catch can't catch error

I have website with masonry blog. I use Masonry js plugin (http://masonry.desandro.com/). But if page doesn't have blog ( for example about page ) I get js error in console: Bad masonry element: ...

Reading div content usig jquery skips html, head and body tags

I am reading one html template and adding it to div (I have set runat='server') from server side code behind. This renders and shows html on page perfectly. Now I change the text within the rendered ...

Javascript Bookmark

I am quite new to coding javascript and i would like some guidance to build my concept. My concept is a basic website that you can bookmark and run javascript. The bookmark is used on a website to ...

Fading out neighbouring countries on google maps?

I want to highlight a country on google maps (or something similar). The way I want to highlight the country is to lower the opacity of all neighbouring countries. I've tried it with google maps, but ...

How to change the text of “Are you sure you want to leave this page?” function script of “onunload”?

How to change the text of this function script?: window.onbeforeunload = function(e) { return 'Are you sure you want to leave this page? You will lose any unsaved data.'; }; ...

Angular Requesting a csv file download url, and force download

How to trigger a csv file download from within Angular on a button click? The backend is the php route. I tried solutions which adds an anchor tag dynamically and appends to it's href attribute, the ...

Javascript class variables - this. or var

Should 'this.' or 'var' be used to create variables in a Javascript class or does it not matter which is used. Obviously those defined with this. will be accessible from outside the object whereas ...

Angular 2: View not updating on array push

I have two child components. They are sharing data from a json file that I am loading using the http.get/subscribe method. For some reason, when I push data into the array, it doesnt update in the ...
Translating... 0%