[英]Filter sending blank messages from contact form 7
我想在其他設置中將此代碼集成到我的聯系表7中:
on_sent_ok: " if (document.getElementById("textArea1").value.trim() == '') {alert("no Message");}"
邏輯應該是這樣的:
if textarea1 == " " alert message not to send the message else send the message
在放置我的代碼時:當我嘗試放置一些“”空格並發送時,出現一條消息:
“您的消息發送成功”-在警報彈出消息(“無消息”)之后出現,然后檢查我的電子郵件是否發送了空格。我計划在有人嘗試發送空格時不發送一些空格。 如何解決此問題?僅發送空白時如何過濾?
使用jQuery
您可以使用$.trim()
函數調整空間。
if($.trim($("#textArea1").val()) == "")
{
alert(" message not to send the message");
}
else
{
alert("Message sent successfully");
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.