【问题标题】:Filter sending blank messages from contact form 7过滤从联系表 7 发送空白消息
【发布时间】:2015-02-05 08:36:08
【问题描述】:

我想将此代码集成到我的联系表格 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

在输入我的代码时:当我尝试输入一些“”空格并发送它时,一条消息:

“您的消息发送成功” - 出现在警报弹出消息(“无消息”)之后,然后检查我的电子邮件是否已发送空格。我计划在有人尝试发送空格时不发送一些空格. 我该如何解决这个问题?只发送空格时如何过滤?

【问题讨论】:

    标签: php jquery wordpress forms textarea


    【解决方案1】:

    使用jQuery,您可以使用$.trim() 函数修剪空间。

    if($.trim($("#textArea1").val()) == "")
    {
      alert(" message not to send the message");
    }
    else 
    {
      alert("Message sent successfully");
    }
    

    【讨论】:

    • 如何将它集成到 wordpress 中以联系表格 7?我是 jquery 的新手 .. 请帮忙
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-11-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-29
    相关资源
    最近更新 更多