·

javascript

Simple Focus labels with Knockout

A couple of days ago I wrote a small article about how to create simple focus labels with JavaScript. For those who havent read that article, it’s how to create form elements with placeholders that transform into labels: In this article, I’ll do the same thing, but with Knockout components.read further ...

Simple Focus Labels with JavaScript

You might already have seen this design element here and there: input placeholder that transform into labels as soon as the input element gets focus or already has a value. This is a very simple solution for a misconception by a lot of designers. Consider the following form: As a web developer, you probably have already seen read further ...

Floating point numbers in PHP and your system locale

So the other day I had a strange issue with a certain part on a Magento webshop that I was working on: The checkout wasn’t working. It turned out that there was a parsing error in the JavaScript that stopped the execution of the rest of the script: Needless to say, in the snippet above it’s clear what’s read further ...

How to write unit tests for your websites’ JavaScript with Mocha

As some of you might know, I’ve already written a lot of posts about unit testing in PHP. But what about your JavaScript? That might require testing too. Especially when it comes to critical functions that involve complex operations. One road you could take to do this is use a headless browser and a testing read further ...

How to create a neat star rating with CSS and JavaScript

So I wrote a simple piece of JavaScript the other day that showcases a neat star rating effect. In this article I’ll not only showcase this effect, but I’ll also explain some of the code that’s going on in it.read further ...

What is keyCode 229?

So today I stumbled into another fine situation: I had an input-field in a form that would only require numbers. To prevent the user from entering numbers I created a simple JavaScript method that looked something like this: This works fine. Except for some Android phones. Not all. Some. So what was going on?read further ...

How I Write JavaScript nowadays

When it comes to JavaScript, I’ve come a long way. When I was a kid, I wrote my first sample of JavaScript with a simple alert() -method. Later, at school, I learned using different frameworks to accomplish various tasks, like MooTools for accordeon menu’s and Prototype for my first taste of AJAX. And in the end I – like many others read further ...

Detect changes on HTML element with the MutationObserver

Recently I ran in a situation of which I’m sure some of you also encountered at some point: I had to perform an action when the class of an element changed. This change was done by an external plugin and I didn’t want to edit to source of that plugin to provide a hook. So how did I read further ...

How to parse XPath in NodeJS

Need to parse an XML Document in NodeJS using XPath? Here’s how: Such a tiny little snippet…read further ...

1 2