내가 원하는 값에 액세스하는 방법을 모르겠다. 나는 많은 것을 시도했지만 내 값을 찾는 방법을 모른다..next (". myClass") Not Jquery
<table class="liste">
<tbody>
<tr>
<th>Actions</th>
<th>Nom</th>
<th>Coordonnées</th>
<th>Diplômes</th>
<th>Profil associé</th>
</tr>
<tr>
<td class="groupe" colspan="5">2014-2015
<button class="copyMails" title="Copier les adresses emails">
<img src="/images/picto/action_dupliquer.png" alt="">
Copier les adresses emails
</button>
</td>
</tr>
<tr>
<td>
<input type="text" class="lstMails" value="myText">
</td>
</tr>
<tr>
<th>Actions</th>
<th>Nom</th>
<th>Coordonnées</th>
<th>Diplômes</th>
<th>Profil associé</th>
</tr>
<tr>
<td class="groupe" colspan="5">2014-2015
<button class="copyMails" title="Copier les adresses emails">
<img src="/images/picto/action_dupliquer.png" alt="">
Copier les adresses emails
</button>
</td>
</tr>
<tr>
BLABLABLA
</tr>
<tr>
BLABLABLA
</tr>
<tr>
<td>
<input type="text" class="lstMails" value="myText2">
</td>
</tr>
</tbody>
</table>
여기
내 JS :
$("body").on('click', ".copyMails", function() {
console.log($(this).parent().parent().parent().next('.lstMails').val());
});
나는에 더 적은 등으로 부모를 시도했다 그러나 나는이 작업을 수행하는 방법을 모르는 여기 내 HTML입니다. 나는 버튼 .copyMails
당신은 다음tr
형제 다음
lstMails
요소를 찾을 필요가
만들기 작업 바이올린을위한 사용할 수 있습니다 다음
tr
를 가리 키도록 다음next()
을 사용하여 부모tr
을 탐색 할closest()
를 사용한다 그것 – Innodel