JQuery 提示用户名密码不为空

$(document).ready(function(){
        
        //HTML()替换   HTML函数
        //append()追加  :input = :text,:password
            $(":text,:password").blur(function(){
            var v = $(this).val();
            $(this).next().remove();
            
            if(v==""){
                //$(this).parent().html("用户名不能为空");
                var name = $(this).attr("name");
                $(this).parent().append("<font color='red'>"+name+"不能为空");
            }
            
            });
        });
posted @ 2015-12-03 11:06  宝贝企鹅  阅读(818)  评论(0)    收藏  举报