Posted by Jamie Munro | February 13, 2012 |
Probably not required often, but you just never know when you might need to set the cursor position inside a textarea tag that you have on your website. Perhaps you want to add a button that will insert some text before the current cursor position and set the cursor back to where the user left it afterwards. In the following example, I will create some basic functions to allow you to set where the cursor goes inside of a textarea.
Posted by Jamie Munro | January 30, 2012 | Tags: jquery
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.
Posted by Jamie Munro | January 16, 2012 | Tags: jquery
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.
Posted by Jamie Munro | January 2, 2012 | Tags: jquery
You want to do some conditional processing depending on if an item or items exist in your DOM (Document Object Model).
Posted by Jamie Munro | December 19, 2011 | Tags: jquery
Posted by Jamie Munro | December 12, 2011 | Tags: jquery
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.
Posted by Jamie Munro | November 21, 2011 | Tags: jquery
I was recently answering some questions on Stackoverflow and an intriguing question came up. How do I split an unordered list into a multiple lists to turn them into columns?
- Test 1
- Test 2
- Test 3
One of the keys of course is speed and not duplicating/cloning the DOM elements because it will be extremely inefficient.
Posted by Jamie Munro | November 14, 2011 | Tags: jquery
jQuery’s $.map() function is a pretty neat function. It accepts an array as a parameter and then will iterate through each item in the array allowing you to further manipulate and build a new array with that data. This article will explore how to use it while providing a useful example.
Posted by Jamie Munro | October 10, 2011 | Tags: html5
It’s time to permanently remove all “manual” sorting from the Internet. You know the one I mean where it has the up and down arrows – or even worse, the text box that accepts a numerical order input. By implementing the jQuery Sortable Plugin, you will be able to provide a simple, but effective drag-and-drop ordering solution for just about any type of data!