2017-03-01 4 views
1

도움이 필요합니다. 아래 코드가 있습니다. 스크립트는 각 버튼의 ID를 반환합니다.문의 양식에 표시되는 Id 값 7

그런 다음 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

내 양식이있는 ID로 양식 값을 설정 * [text * your-name] 이메일 * [email * your email] [제출 "S'inscrire"] 어떻게 값을 통합 할 수 있습니까? – Trevize

+0

[contact-form-7-dynamic-text-extension] (https://wordpress.org/plugins/contact-form-7-dynamic-text-extension/) 여기를보세요 –

+0

예, 이미이 확장 기능을 사용하고 있습니다. 하지만 자바 스크립트 값에 대해서는 아무 것도 발견하지 못했습니다. [dynamictext dynamicname 'myField']를 시도했지만 값이 아닌 MyField를 반환했습니다. – Trevize