Looping Arrays in Javascript [duplicate]

This question already has answers here:...

Playing with HTML's ordered list number bullets

Can anyone think of a way to use the numbers in an ol/li list to label images?  <ol>   <li><img /></li>   <li><img /></li>   <li><img /></li> </ol>   With some CSS applied should outpu...

Angular $animate.enabled: disabling element's animation

I've been running into trouble using the $animate.enabled method to programmatically disable and enable animation on a given element (via a directive). There are many solutions online that use this technique, so I can only assume I'm missing...

What does explicitly & implicitly mean in JavaScript?

I often see the terms explicitly & implicitly used in JavaScript and I'm still not sure I know what they mean i.e the following text from the MDC site describing the object model.     The constructor function explicitly   sets the value of th...

select data based on multiple attributes d3

I have a grid represented using d3 and svg. I am trying to select the neighbouring (adjacent) tiles to any specific tile on the grid. the tiles are accessed via their x and y coordinates on the grid. What I have feels fairly messy, and doesn't do...

Async update of array in Angular

I have a view where I render tweets. Inside the tweets, there is the user_mentions array. From this array, I want to get one user, make another request to the API, get the avatar for the user and then render it.  The view looks like:  <md-item ng-...

How to handle decimal values in React's onChange event for input? [duplicate]

This question already has answers here:...

AngularJS set ng-controller with scope variables

I have a template (for a modal popup) and depending on its function, different controllers should be loaded:  <div id="MsgBoxBack" ng-controller="{{notification.ctrl}}">   Controllers:  app.controller('MainCtrl', ['$...

parse.com REST API using build.phonegap Javascript Push Notifications Android and iOS

Currently using build.phonegap.com and parse.com to enable push notifications across two platforms (Android and iOS).  Using the PhoneGap PushPlugin and parse.com REST API I'm able to register an Android device and send the details to parse succe...

Find the user, repo and path from a github url

I need to be able to get the user, repo and path from a github url (to a file in the repo) that is pasted into a form, to be able to make api requests on it. e.g. https://github.com/HubSpot/BuckyClient/blob/master/README.md  I've started writing...

Client Server array change detection best practices or design pattern [closed]

Which technique are you using when you want to detect changes on the server side in array sent by client?  E.g. very simple scenario, we have an array of Persons, client side gets it from server, and changes it in three ways   Adds new Person Update...

Deleted DataTable row gets added again after sorting

I am using the DataTables jQuery plugin to display an HTML table and I have made an AJAX row deletion function that sends the deletion POST request in the background and displays the returned HTML message in an #info div and removes the related HTML...

One-time binding of method parameter

I am attempting to one-time bind a parameter within an ng-click method.  The HTML is being generated in the controller as part of a qTip tooltip.  I have tried placing '::' before the method and the parameter, but I still end up with persiste...

Point in Polygon Hit Test in JavaScript (Chrome bug)

I am working on a game written in javaScript / jQuery. Part of my code draws a random polygon (an island) on a tile grid. I need to check if a point is inside the polygon.  I am using a point-in-polygon intersection script which I found in several pl...

Highcharts - xAxis label for each point

Question: "Is there a way to force an xAxis label for each point?"    Basically, I have a time series and I need to label Every point on the xAxis... These points could be at any interval....

Shiny Loading Spinner displaying too frequently

I have a loading spinner in shiny which is implemented similarly to this answer:   conditionalPanel(condition="$('html').hasClass('shiny-busy')",                  tags$div("Loading...",id="loadmessage") )    ru...

Sortable appending to wrong target

I have a sortable element whose children are also sortable.  Here's a JSFiddle  demonstrating what I've got so far.  In the fiddle or image below, the blue area is #container, white boxes are .child and group of such boxes marked with a black...

:Active style appears as being applied to random divs on tap in Mobile Safari

Upon release of a button, one of the other buttons flickers on its :active styling. You can see in my gif that it seems to only happen when clicking the function and advanced divs. ( tapping on the design div seems to behave normally ).   Some back...

Chrome extension tabs sendMessage from background to contentscript errors

contentscript.js  chrome.runtime.onMessage.addListener(   function(request, sender, sendResponse) {     console.log(sender.tab ?                 "from a content script:" + sender.tab.url :                 "from the extension");     if...

Is it good practice to prototype a JavaScript 'equals' method for custom object declarations, and if so how?

I'm trying to create a set of re-usable objects in javascript and some of the managed-framework paradigms (like .NET) don't directly translate.  For instance, there is no global getType() method or its equivalent, and there is no default equa...

How to hide the contents of the tab [duplicate]

This question already has answers here:...

How to notify client's browser about some event on server?

I'm using python (Tornado) on server side and some javascript on a client side. I have the common situation - one user send a message to another. And I want server to notify client's browser (reciever of the message) about new message. How ca...

How to create link on image using Javascript

<div id="mydiv"> <img src="myimage.jpg" /> </div> <script language="javascript"> var a=document.createElement('a'); a.href='http://mylink.com'; document.getElementById('mydiv').a...

How to use jsPDF correctly?

I am a newbie trying to use jsPDF. I have a simple link that will build a pdf file and save it. However I can't get it to work. When I click the link, nothing happens. It's as if I'm not referencing the scripts. Am I missing something?  E...

Passing HTML over AJAX call to C# MVC Controller. 500 Error

So I'm getting a bit stumped by this one. I've got multiple pages making lots of successful Ajax calls to my C# controllers on the back end with a variety of data, but now I'm trying to build a simple little content management functionali...

Why does `{} + 1` get number 1 in Chrome and Firefox, but string '[object Object]1' in Node.js?

Addition in Javascript is really amazing. In Chrome and Firefox, {} + 1 equals number 1; but in Node.js, {} + 1 equals string '[object Object]1'. On other hand, 1 + {} equals '1[object Object]' in both browsers and Node.js. Who can ex...

Data displayed with ngrepeat not passing to function

I have an AngularFire object ($firebaseObject()) named ctrl.data, which ng-repeat displays. In the markup generated by ng-repeat I have a button which runs a function when clicked. I would like to pass information from the item that ng-repeat used to...

Devise validation of an email address returns: 'is invalid' to my client side validation

I am using the judge gem to do client side validation of form inputs, but I am having some problems validating the email attribute in my User model. I am using devise's validatable module to perform validation of the uniqueness of the email as we...

Give focus to browser

I'm working on keyboard accessibility. I have a flash object which sits inside a page, and to stop the focus getting trapped inside it, I've added tab listeners which talk through ExternalInterface to some JavaScript functions.  The JavaScrip...

Webpack plugin: How to dynamically add a loader to a module?

I'm writing a Webpack plugin. During module resolution, this plugin should dynamically add a specific loader for some modules, but not for all.  My idea right now is to tap into normal-module-factory's after-resolve event. There, I could modi...