powered by Slim Framework
enhanced by Nesbot.com

jQuery: Padding a Variable or String with a Specific Character

Published on Jan 30, 2012 by Jamie Munro

Every so often you will receive data from a database or potentially user input, but a specific number of characters might be required to format or display the data properly.  As an example, you may wish to ensure that a number less than 9 is prefixed with a 0 where numbers that are 10 or more do not need the padding.  By extending jQuery, two functions can be created to either prefix or postfix a specific value to a DOM element using a jQuery selector.

Read more >

Tags: Javascript | jquery

jQuery: Creating Your Own Selector

Published on Jan 16, 2012 by Jamie Munro

By default, the jQuery selectors are pretty advanced.  You can select items by classes, ids, attributes, the first, the last, etc…  But why stop there?  By simply extending jQuery, we can add our own custom selectors to further enhance how we use jQuery.

Read more >

Tags: Javascript | jquery

jQuery: Checking if an element exists

Published on Jan 2, 2012 by Jamie Munro

You want to do some conditional processing depending on if an item or items exist in your DOM (Document Object Model).

Read more >

Tags: Javascript | jquery

jQuery: Implementing a callback

Published on Dec 19, 2011 by Jamie Munro

As we move into a more and more interactive era of website development, more of the JavaScript work is being done asynchronously and not "top-down".  This can provide some interesting challenges, for example, executing a specific action after a specific process has been completed – also known as a callback.  Thankfully, jQuery provides some useful functions to help with this process.

Read more >

Tags: Javascript | jquery

jQuery: Global AJAX Events for Start, Stop, Complete, or Error

Published on Dec 12, 2011 by Jamie Munro

Your website contains a lot of AJAX requests using jQuery and you want to add a global event at the start or finish of the AJAX request, e.g. add a spinning icon, or handle all AJAX errors in a particular fashion.

Read more >

Tags: Javascript | jquery

CSS: Fixed Position Content

Published on Oct 3, 2011 by Jamie Munro