Quantcast
Channel: WordPress.org Forums » [Contact Form 7] Support
Viewing all articles
Browse latest Browse all 49500

SimonMacFadyen on "[Plugin: Contact Form 7] Internet Explorer 7 and 8 Watermark Text"

$
0
0

I used a conditional IE.js file to execute the below code:

$(function () {
    //Assign to those input elements that have 'placeholder' attribute
    $('input[placeholder]').each(function(){
        var input = $(this);
        $(input).val(input.attr('placeholder'));

        $(input).focus(function(){
            if (input.val() == input.attr('placeholder')) {
               input.val('');
            }
        });

        $(input).blur(function(){
           if (input.val() == '' || input.val() == input.attr('placeholder')) {
               input.val(input.attr('placeholder'));
           }
        });
    });
});

Make sure you include the code AFTER jQuery, so if you're loading your scripts in your footer, place your conditional IE statement after wp_footer();

<?php wp_footer(); ?>

<!--[if lt IE 9]>
    <script src="<?php bloginfo('template_url');?>/assets/js/IE.js"></script>
<![endif]-->

Viewing all articles
Browse latest Browse all 49500

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>