My apologies. I accidentally deleted it out of there. It has been reinserted.
Additionally, I found a different method that works with everything except for gravity forms.
The JS is
jQuery("input[type='checkbox']").each(function() {
var jQuerythis = jQuery(this);
jQuerythis.hide();
var jQueryimage = jQuery("<img src='http://developer.impactpartner.com/albertson/wp-content/uploads/2013/01/checkbox-unchecked.png' class='testbox' />").insertAfter(this);
jQueryimage.bind("click", function() {
var jQuerycheckbox = jQuery(this).prev("input");
jQuerycheckbox.prop("checked", !jQuerycheckbox.prop("checked"));
checkImage();
})
function checkImage() {
if(jQueryimage.prev("input[type='checkbox']").prop("checked")) {
jQueryimage.attr("src", "http://developer.impactpartner.com/albertson/wp-content/uploads/2013/01/checkbox-checked.png");
jQueryimage.attr("class", "testbox");
} else {
jQueryimage.attr("src", "http://developer.impactpartner.com/albertson/wp-content/uploads/2013/01/checkbox-unchecked.png");
jQueryimage.attr("class", "testbox");
}
}
});
});
You will see it working at the bottom of the page with Contact Form 7. I have tried adding the class "testbox" in the CSS Class Name of the checkbox in Gravity Forms but it doesn't seem to work for me.
Posted 11 years ago on Monday January 28, 2013 |
Permalink