2017-03-01 8 views
1

私は助けが必要です。 私は以下のコードを持っています:スクリプトは各ボタンのidを返します。お問い合わせフォーム7のID値を表示

その後、選択したid値をWordpressの連絡先フォーム7で生成されたフォームに戻す必要があります。

私の状況では、各ボタンはフォームでモーダルを開きます。 しかし、私のフォームに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>

答えて

0

もID

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

でフォームの値を設定し、私のフォームがあります。名前* [テキスト*あなたの名前] メール* [email *あなたのメール] [送信 "S'inscrire"]どのように値を統合できますか? – Trevize

+0

[contact-form-7-dynamic-text-extension](https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/)ここをクリック –

+0

はい、既にこの拡張機能を使用しています私はjavascriptの値について何も見つかりませんでした。私は[dynamicictext dynamicname 'myField']を試しましたが、値ではなくMyFieldを返します – Trevize

関連する問題