Archive for the ‘jquery’ Category

jQuery .is method.

March 26th, 2012 No comments

This is probably the best way I’ve seen to see if a checkbox is checked or not on a click event…


Some more awesome jQuery checkbox reference material:

Categories: jquery Tags:

Using Google CDN jQuery and jQuery ui.

July 28th, 2011 No comments

I add these to almost every page I create. Next time you want to include jQuery and jQuery ui in a page, just copy these three tags and drop them in your head. Viola! jQuery, courtesy of Google! And if everybody did this, the web would be faster…

Categories: javascript, jquery Tags:

A very nice jQuery plugin for text input hint / helper text…

June 24th, 2011 No comments

While looking for a jQuery plugin that would let me put some default text in a field and then remove it when a user focuses and before submit is clicked, I stumbled across this plugin:  labelOver

You can view an example here.

The advantage over this plugin is two fold.  First, it doesn’t actually ever put text into the input box, rather it positions the inputs Label tag over the field…  This is good for several reasons.

  • The label tag is used by screen readers, etc…
  • It works fine if javascript and css are off (not a big deal but still a good thing).
  • It lets you style the label with other html tags (like strong, etc…)
Categories: html5, jquery Tags:

Turn off jQuery .load caching…

June 22nd, 2011 No comments

IE7 has this nasty habbit of caching ajax requests very very agressivly. Which stinks because more often than not ajax content is very dynamic and thus what you don’t want cached!

Fortunatly jQuery provides an easy way to disable all ajax caching with just one statement.

$.ajaxSetup ({
    // Disable caching of AJAX responses
    cache: false

See: for the original post.

Categories: ajax, jquery Tags:

Using Selenium to test Ajax

December 1st, 2010 2 comments

If you’ve used Selenium before you know it’s power, and the pain of Ajax and Selenium…  I spent about a week on it at work and created several helper methods, but was never quite happy with my Ajax solution (waiting for text to be present, blech!!!).  Then, I found this article about getting selenium and ajax to play nicely…

It turns out the major JavaScript libraries (jQuery, YUI (v3+), Prototype, and Dojo) provide a way to see if requests are still active.  They provided instructions for writing a function, but I wanted a fool proof method, that JUST WORKS regardless of what library you use.

So, I created this function (Currently supports jQuery, Dojo, and Prototype, not Yui 3 yet):

function getActiveRequestCount(){
    var currentActiveRequestCount = 0;
    //Get prototype active requests...
    if(window.Ajax && window.Ajax.activeRequestCount){
        currentActiveRequestCount += window.Ajax.activeRequestCount;

    //jQuery active requests...
        currentActiveRequestCount +=;

    if(window.dojo &&{
        currentActiveRequestCount +=;
    return currentActiveRequestCount;

Then, use the following selenium command to wait for the request count to be low…

selenium.waitForCondition("selenium.browserbot.getCurrentWindow().getActiveRequestCount() == 0", "30000");

And viola!!!  No more pesky pauses!!!  Or wait for text to be present!!!

Categories: ajax, dojo, html, jquery, selenium, yui Tags: