A Javascript Hack (using prototype)

Javascript with Prototype is the next best thing to ruby.

Okay, okay, this is a hack and it's not readable, but I was still tickled when I got this to work:

$A($('newqueuerequest').getElementsByTagName('img')).findAll( function(img) { return (img.src.indexOf("icons/red-x.gif") > -1); }).inspect();

Translation: "Give me a list of all img tags that have a red-x."

(I'm using this to ensure all fields are validated in a form, because the validation is complex.)

No comments: