It jquery determine whether textarea tag is empty

if(!$("#reply-comment").val().replace(/ +/g,"").replace(/[\r\n]/g,"")){
                $("#reply-comment").next("span").css("color", "red").text("内容不能为空");
            }
replace(/ +/g,"")  # 去掉空格
replace(/[\r\n]/g,"")  # 去掉换行
Published 141 original articles · won praise 131 · views 210 000 +

Guess you like

Origin blog.csdn.net/qq_41621362/article/details/102959179