【问题标题】:Display Id value in contact form 7在联系表格 7 中显示 Id 值
【发布时间】:2017-03-01 17:46:04
【问题描述】:

我需要帮助。 我有下面的代码:脚本返回每个按钮的 id。

之后,我需要在 Wordpress 中以联系表单 7 生成的表单返回所选的 id 值。

在我的情况下,每个按钮都会打开一个带有表单的模式。 但是我无法返回表单中的id...

function getId(myId)
{
document.getElementById("recupTitle").textContent = myId.id;
}
<ul>
<li><button id="1" onclick="getId(this);">Click the button 1</button></li>
<li><button id="2" onclick="getId(this);">Click the button 2</button></li>
<li><button id="3" onclick="getId(this);">Click the button 3</button></li>
<li><button id="4" onclick="getId(this);">Click the button 4</button></li>
<li><button id="5" onclick="getId(this);">Click the button 5</button></li>
</ul>

<p id="recupTitle"></p>

【问题讨论】:

    标签: javascript wordpress contact-form contact-form-7


    【解决方案1】:

    点击时还设置带有 id 的表单值

    document.getElementById("myField").value = myId.id;
    

    【讨论】:

    • 有我的表格:姓名* [text* your-name] Email* [email* your-email] [submit "S'inscrire"] 如何整合价值?
    • 是的,我已经使用了这个扩展,但我没有发现任何关于 javascript 值的信息。我试过 [dynamictext dynamicname 'myField'] 但返回 MyField,而不是值
    • 好的,抱歉...现在可以使用了。我在我的表单中插入 [dynamictext Title id:myField "'myField'"]。谢谢你的帮助!
    • 你完成了我刚刚给你提示的工作 :)
    猜你喜欢
    • 1970-01-01
    • 2018-02-24
    • 1970-01-01
    • 1970-01-01
    • 2017-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多