Javascript / DHTML Web Log Entries
Using Logical Operators To Perform Ternary Operations In Javascript
Posted: November 18, 2009 at 10:13 AM by Ben Nadel
Yesterday on Twitter, Cody Lindley pointed out that logical operators in Javascript (&& and ||) don't simply return True or False - they return specific operands used in the logical statement. While I have leveraged this concept in the past with statements like this: // Logical OR in assignment. var options = (options || defaultOptio... read more »
Comments (33) | Post Comment | Ask Ben | Permalink
Looping Over ColdFusion JSON Queries In jQuery
Posted: November 16, 2009 at 9:45 AM by Ben Nadel
I've talked to people many times about how to loop over ColdFusion queries that have been returned from an AJAX call in JSON format. The serialized format of ColdFusion queries are a bit round-about since they are designed for memory optimization, not necessarily usability. As such, I often wind up telling people that I prefer to convert my querie... read more »
Comments (11) | Post Comment | Ask Ben | Permalink
Track Document-Level Clicks With jQuery MouseDown Events
Posted: November 12, 2009 at 9:25 AM by Ben Nadel
The other day, I dicussed jQuery's live() event method and why understanding the mechanics behind it was extremely important; the reason being that the live() event method depends completely on the ability for a given event type to bubble up through the DOM (Document Object Model) tree. That post got me thinking about event bubbling in general a... read more »
Comments (12) | Post Comment | Ask Ben | Permalink
Tracking Google AdSense Clicks With jQuery And ColdFusion
Posted: November 10, 2009 at 9:36 AM by Ben Nadel
While Google AdSense is in no way a driving force behind my blogging - I just love being a programmer - sometimes, it would be nice to know which pages on my site generated the most Google AdSense clicks. This might be something that I can find out from Google AdSense reporting or from Google Analytics; but, to be honest, I don't know all that m... read more »
Comments (21) | Post Comment | Ask Ben | Permalink
jQuery Live() Method And Event Bubbling
Posted: November 9, 2009 at 8:54 PM by Ben Nadel
Recently, there has been a lot of talk in the development community about jQuery's new live() event method. People are just in love with it. If you have not heard of jQuery's live() method, it's an event delegation mechanism that allows you to bind event handlers not just to all existing instances of a given node type, but also to any future insta... read more »
Comments (10) | Post Comment | Ask Ben | Permalink
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 (13) | 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 (28) | 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 (8) | 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 »



