A few days ago, i’ve been working on a templating system.
If you’re not used to what a template is, let’s say it’s just a chunk of HTML you use in multiple places, and that it can be filled with variables. That, for example, could be a template:
<div class="user"> <h3><?php echo $name; ?></h3> <img src="<?php echo $picture; ?>"/> </div>
We want to fill that template with proper variables, then… [Lire la suite]
With jQuery, there’s no event to subscribe to when you want to know when an element is removed from the DOM.
But that doesn’t mean you’ll never need that. Actually, it can come in handy for a lot of things, such as when you’re using tooltips.
When your mouse enters an element, you’ll make a little tooltip pop-up above the element to show more informations; and when your mouse leaves that element, the tooltip will disappear.
Now, what happens if… [Lire la suite]

Every jQuery developer, once familiarized with the language, wants to start creating plugins. That’s an efficient and easy way to avoid duplicating code. Most of all, the result is awesomely thrilling to use: a simple $(‘p’).goBananas() could transform all your paragraphs into flying bananas!
Let’s start with the basics. If you already know them, you may jump over this part.
First, when working with jQuery, a good practice is to wrap your code… [Lire la suite]

Let’s talk JavaScript. You all know about the « onload » event which is triggered when a page is fully loaded, right?
And if you use JavaScript frameworks such as jQuery or MooTools (or others), it’s most likely you also heard about the « onready » event. It’s triggered earlier, when all DOM elements are here an ready to rock, but before things like scripts, images and iframes are fully loaded, buying you some precious time to run your JavaScript.
It’s pretty nifty,… [Lire la suite]