Monday 9 December 2013

IE-9 is not supporting place holder

We can implement place holder property using jquery.
The below code will help you

if ($.browser.msie) {
                $("input").each(function () {
                    if (IsNull($(this).val()) && $(this).attr("placeholder") != "") {
                        $(this).val($(this).attr("placeholder")).addClass('hasPlaceHolder');
                        $(this).keypress(function () {
                            if ($(this).hasClass('hasPlaceHolder')) $(this).val("").removeClass('hasPlaceHolder');
                        });
                        $(this).blur(function () {
                            if ($(this).val() == "") $(this).val($(this).attr("placeholder")).addClass('hasPlaceHolder');
                        });
                    }
                });
            }