一个失去焦点事件中——单引号与双引号带来的疑惑

$(function(){
            $("#eg01").focus(function(){
                $(this).addClass("focus");
                if($(this).val() == this.defaultValue){
                    $(this).val("");
                }
            }).blur(function(){$(this).removeClass("focus");
                if($(this).val()== ''){
                    $(this).val(this.defaultValue);
                }
            })
        })

 

上述代码 其中   if($(this).val()== '')  使用单引号,效果正常。而val()==""      换成双引号了,效果刚顿时失效,因何致此?      

posted @ 2013-01-15 17:57  林悠扬  阅读(218)  评论(2编辑  收藏  举报