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+"不能为空");
            }
            
            });
        });
原文地址:https://www.cnblogs.com/baobeiqi-e/p/9884831.html