javascript


javascript - jQuery - select the associated label element of a input field

You shouldn't rely on the order of elements by using prev or next. Just use the for attribute of the label, as it should correspond to the ID of the element you're currently manipulating: var label =... Read More


javascript - Regex to replace everything except numbers and a decimal point

Use this: document.getElementById(target).value = newVal.replace(/[^0-9.]/g, "");... Read More


What does the regex \S mean in JavaScript?

\s matches whitespace (spaces, tabs and new lines). \S is negated \s.... Read More


javascript - How to filter (key, value) with ng-repeat in AngularJs?

Angular filters can only be applied to arrays and not objects, from angular's API - "Selects a subset of items from array and returns it as a new array." You have two options here: 1) move $scope.... Read More


javascript - Transparent background with three.js

If you want a transparent background in three.js, you need pass in the alpha parameter to the WebGLRenderer constructor. var renderer = new THREE.WebGLRenderer( { alpha: true } ); You can leave the c... Read More


javascript - Set custom HTML5 required field validation message

Code snippet Since this answer got very much attention, here is a nice configurable snippet I came up with: /** * @author ComFreek <https://stackoverflow.com/users/603003/comfreek> * @link https:... Read More


How can I access a JavaScript object which has spaces in the object's key?

Use ECMAscripts "bracket notation": myTextOptions[ 'character names' ].kid; You can use that notation either way, reading & writting. For more information read out here: https://developer.mozilla.or... Read More


How to detect my browser version and operating system using JavaScript?

Detecting browser's details: var nVer = navigator.appVersion; var nAgt = navigator.userAgent; var browserName = navigator.appName; var fullVersion = ''+parseFloat(navigator.appVersion); var majorV... Read More


javascript - What is "callback hell" and how and why does RX solve it?

1) What is a "callback hell" for someone who does not know javascript and node.js ? This other question has some examples of Javascript callback hell: How to avoid long nesting of asynchronous functi... Read More


javascript - What do the different readystates in XMLHttpRequest mean, and how can I use them?

The full list of readyState values is: State Description 0 The request is not initialized 1 The request has been set up 2 The request has been sent 3 The request is in process 4... Read More