Internet Explorer v8 placeholder support

I'm facing an issue, that i could not resolve for a long period of time. The simple problem is that, Internet Explorer 7-8-9 is not supporting placeholders. Although i have found many scripts that should resolve this issue, i could not just make it work. This kind of problem just differs from the others. Here's why:

I'm using a script which simulates placeholders like this: This is correct

Then i write something in it, delete the text and click somewhere else it looks like this: Wrong

If i write something in it, delete and click in an empty textbox, it works well again...

If i use backspace and delete the characters one by one, it works well again...

I'm using this basic script for placeholder support:

<script language="JavaScript" type="text/javascript">

                    $(function(){
                        var element = document.getElementById("entirePageForm:#{MyProfileBackingBean.fieldWithFocus}");
                        if (element != null){
                            element.focus();
                        }
                    });

                    $(function(){
                        var nativePlaceholderSupport = (function(){
                            var i = document.createElement('input');
                            return ('placeholder' in i);
                        })();

                        if(nativePlaceholderSupport){
                            return false;
                        }else{  
                            $(':input').removeData('defaultValued');
                            $('.empty').remove();
                            $(':input').defaultValue(); 
                        }
                    });

            </script>

I don't feel that the script would be the problem, because i tried like 10-15 other scripts. They all worked like this.

Also i'm using:

  • maven 2.1.1
  • wd 3.1.5
  • weblogic 10.3.3.0
  • javax servlet 2.5
  • richfaces 3.3.3
  • I'm really interested if someone has ever met such issue like this and what should be the necessary step to resolve this issue.

    Thanks, Tamas

    链接地址: http://www.djcxy.com/p/12184.html

    上一篇: 如何使div不超过其内容?

    下一篇: Internet Explorer v8占位符支持