PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Images: working in Chrome, IE, Safari but not in IE 8 :-(

  1. wouterbruijning
    Member

    I was trying to insert images as a matter of choosing on http://www.reigerstraat-gouda.nl/onlijn/wie-kies-je/ (just a test-form), using this topic: http://www.gravityhelp.com/forums/topic/can-gf-use-images-to-make-form-selections
    I used the presented solution, added the CSS but it's not working on IE 8. any solution?

    TIA,
    Wouter

    Posted 12 years ago on Saturday April 14, 2012 | Permalink
  2. kyle
    Member

    IE8 isn't clicking the associated radio button when you click on the label. Plus it doesn't support the :checked selector. jQuery can fix both of these things:

    // fix label click in IE
    jQuery("label").click(function(){
        if (jQuery(this).attr("for") != "")
            jQuery("#" + jQuery(this).attr("for")).click();
    });

    and

    // fix border css in IE
    jQuery("input[type='radio']:checked").each( function() {
    	jQuery(this).parent("li").find("label img").css("borderColor", "#000");
    });

    You might want to use "focus" instead of "click" in the first script.

    Posted 12 years ago on Saturday April 14, 2012 | Permalink
  3. wouterbruijning
    Member

    Thank you Kyle!
    Do I put these lines in function.php?

    Posted 12 years ago on Saturday April 14, 2012 | Permalink
  4. kyle
    Member

    Yes. Ideally you want to put them both in a file like iegformfix.jquery.js, and then use the Wp_register_script and wp_enqueue_script functions to add them to your head or footer. When you register the script, make sure you add jquery as one of the dependencies. The codex has some samples you can look at to figure out how.

    Posted 12 years ago on Saturday April 14, 2012 | Permalink