moving an element in JS

To move an element by changing it’s top value, the element can’t have a static position (the default). You’ll need to change the position to absolute, relative, fixed, etc…. Get the current top, left, etc… using Element#getBoundingClientRect, which will give you the correct initial value, and save you the need to parse a string. Since top needs to have a unit (px, em, … Read more

How to remove part of a string?

My favourite way of doing this is “splitting and popping”: split() splits a string into an array of strings using a specified separator string.pop() removes the last element from an array and returns that element.

Clear the cache in JavaScript

How do I clear a browsers cache with JavaScript? We deployed the latest JavaScript code but we are unable to get the latest JavaScript code. Editorial Note: This question is semi-duplicated in the following places, and the answer in the first of the following questions is probably the best. This accepted answer is no longer … Read more