This update allows the use of the semantically correct "for" attribute instead of forcing the label to be immediately after the checkbox. It also requires that the checkbox be hidden via CSS, rather than via the plugin.

    /* Images as Checkboxes */
    jQuery.fn.cssCheckbox = function () {
        jQuery("[EMAIL PROTECTED]", this)
            .each( function(){
                if ( jQuery("#" + jQuery(this).attr("for"))[0].checked )
                    jQuery(this).addClass("checked");
            })
            .hover(
                function() { jQuery(this).addClass("over"); },
                function() { jQuery(this).removeClass("over"); }
            )
            .click( function() {
              checkbox = jQuery("#" + jQuery(this).attr("for"))
                jQuery(this).toggleClass("checked")
              checkbox.click();
            })
    }

--
Yehuda Katz
Web Developer | Wycats Designs
(ph)  718.877.1325
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to