Javascript / DHTML Web Log Entries
Using Regular Expressions In Javascript (A General Overview)
Posted: November 2, 2009 at 10:07 AM by Ben Nadel
I love regular expressions; they are the cat's pajamas. I find that hardly a day goes by where I don't use them in some way to solve a problem. But, as much as I love them, there has always been something about using them in Javascript that has felt a bit shaky. I think it's simply that I didn't have a fleshed out understanding of the full breadth... read more »
Comments (10) | Post Comment | Ask Ben | Permalink
Building A Fixed-Position Bottom Menu Bar (ala FaceBook)
Posted: October 30, 2009 at 9:10 AM by Ben Nadel
Now that I've explored two ways of creating fixed-position elements across browsers - using IE6 expressions and absolute layouts - I wanted to give a go at creating a fixed-position bottom menu bar, ala FaceBook. The menu bar isn't going to contain much of anything - just a single button and a pop-up menu; mostly, I wanted to see how easily I ... read more »
Comments (10) | Post Comment | Ask Ben | Permalink
Using PushStack() In jQuery Plugins To Create New Collections
Posted: October 29, 2009 at 9:58 AM by Ben Nadel
Most of the time, when creating a plugin in jQuery, I'll leverage built-in functions like filter() and each() to select from or alter the current collection. Plugins that are built in this fashion are auto-wired to have the appropriate stack connections; that is, since jQuery performs non-destructive collection augmentation, when you use a plugin ... read more »
Comments (2) | Post Comment | Ask Ben | Permalink
jQuery Powered Mine Sweeper Game
Posted: October 27, 2009 at 10:17 AM by Ben Nadel
While I was on the road going from CFinNC to BFusion / BFLEX, I tinkered around with some jQuery code. I wanted to try and make something fun but not something that would take too much time (since being on the road is exhausting). And so, I created this jQuery powered Mine Sweeper game. Much like the old computer game, you can select the number of... read more »
Comments (21) | Post Comment | Ask Ben | Permalink
Using CSS Fixed Position Elements Across Browsers
Posted: October 15, 2009 at 10:08 AM by Ben Nadel
Even after years of web development, one thing that I never really looked into was fixed-position elements. I've seen them used on websites, and I generally like what they do; but, I've simply never taken the time to look into it. So, I figured this morning would be just as good a time as any. If you are not familiar with what a fixed-position ele... read more »
Comments (24) | Post Comment | Ask Ben | Permalink
jQuery In Action By Bear Bibeault And Yehuda Katz
Posted: October 14, 2009 at 2:42 PM by Ben Nadel
The other night, I finished jQuery In Action by Bear Bibeault and Yehuda Katz . It was a good book, but the distribution of it kind of confused me. I redeemed it electronically from Manning (as an attendee of the jQuery Conference 2009) and then a few days later Manning emails me and tells me that the Second Edition is now available for downl... read more »
Comments (15) | Post Comment | Ask Ben | Permalink
THIS, Function Context, And Object Literals In Javascript
Posted: October 13, 2009 at 8:42 AM by Ben Nadel
In Javascript, the "this" keyword points to the context of the currently executing function. Previously, I had thought that "this" would only work at the object level (treat the object as the context) if the given object was created using the "new" operator. Last night, while finishing up jQuery In Action , I found out that this is not true. A fu... read more »
Comments (4) | Post Comment | Ask Ben | Permalink
jQuery Plugin: From - Filtering A Collection Based On Ancestors
Posted: October 12, 2009 at 9:07 PM by Ben Nadel
I was playing around with a customized version of jQuery's live() method when it occurred to me that being able to filter a given jQuery collection based on a set of potential ancestors might make a useful plugin. And so, I came up with the from() plugin. From() takes a collection target ancestors and filters the existing stack down to only those ... read more »
Comments (6) | Post Comment | Ask Ben | Permalink
Building Single-Page Applications Using jQuery And ColdFusion With Ben Nadel (Video Presentation)
Posted: October 9, 2009 at 2:41 PM by Ben Nadel
The following video and slide show is my presentation: Building Single-Page Applications With jQuery and ColdFusion . Building a single-page application is a radical shift from the request-response lifecycle that many of us are used to. Not only does it require an excellent Javascript abstraction layer like jQuery, it necessitates a more co... read more »
Comments (23) | Post Comment | Ask Ben | Permalink
Passing A Function To jQuery's Attr() Method For Implicit Iteration
Posted: October 7, 2009 at 10:18 AM by Ben Nadel
In the past few weeks, I've outlined a number of really cool tips and tricks that I picked up from Cody Lindley's jQuery Enlightenment book ; to cap it off, I wanted to cover just one more: passing a function as the second argument to the jQuery collection Attr() method. Typically, when we want to set the attribute of a given element using jQuery... read more »
Comments (9) | Post Comment | Ask Ben | Permalink
jQuery's Closest() Method Returns Only One Ancestor
Posted: October 6, 2009 at 9:31 AM by Ben Nadel
If you need to get an anscestor of a given element, jQuery's parents() method is really useful. Not only will it crawl up through the DOM tree, it allows you to supply a jQuery selector that can filter the collection of parent nodes that is returned. This works in most cases; however, when the anscestor or parent that you are looking for depends o... read more »
Comments (11) | Post Comment | Ask Ben | Permalink
Viewing jQuery DOM Event Bindings With FireBug
Posted: October 5, 2009 at 10:27 AM by Ben Nadel
The ease with which we can bind events to DOM elements using jQuery is a huge part of what makes jQuery so awesome. But, as with many things that are wired-up programmatically, when something doesn't work, it can be hard to figure out where it went wrong. One cool tip that I picked up reading Cody Lindley's jQuery Enlightenment book is that jQue... read more »
Comments (9) | Post Comment | Ask Ben | Permalink
jQuery's is() Method Checks For Any Matching Elements
Posted: October 1, 2009 at 2:14 PM by Ben Nadel
This is a really tiny post, but just something that I wanted to point out. The is() method in jQuery will return true if any of the elements in the current collection match any of the elements in the is-based collection (as defined by the given selector). Normally, if you're working with just a single element, there's no problem; but, if your curr... read more »
Comments (9) | Post Comment | Ask Ben | Permalink
Using Javascript's IN Operator To Test For Object Property Existence
Posted: October 1, 2009 at 9:05 AM by Ben Nadel
A small, but powerful tip that I picked up while reading Cody Lindley's jQuery Enlightenment book , was the use of Javascript's IN operator to test for object property existence. Before that, I had only ever used the IN operator to iterate over an object's keys, as in: for (var key in myObject){ // ... key is iteration index value ... } T... read more »
Comments (8) | Post Comment | Ask Ben | Permalink
jQuery's Filter() Method Can Take A Callback Function For Advanced Filtering
Posted: September 25, 2009 at 10:07 AM by Ben Nadel
I think one of the most awesome tips that I picked up while reading Cody Lindley's jQuery Enlightenment book was that the filter() method can take a callback function as its argument. Typically, when I use jQuery's filter() method, I simply pass in a selector that it would then use to narrow down the collection of DOM elements: var items = $(... read more »



