Jquery判定textarea标签内容是否为空

if(!$("#reply-comment").val().replace(/ +/g,"").replace(/[\r\n]/g,"")){
                $("#reply-comment").next("span").css("color", "red").text("内容不能为空");
            }
replace(/ +/g,"")  # 去掉空格
replace(/[\r\n]/g,"")  # 去掉换行
发布了141 篇原创文章 · 获赞 131 · 访问量 21万+

猜你喜欢

转载自blog.csdn.net/qq_41621362/article/details/102959179
今日推荐