Das Problem ist, dass selbst wenn die zweite Schaltfläche angeklickt wird, es nur erste Anmeldeinformationen findet. Also, was ich will, wenn ich auf die zweite Schaltfläche klicken, sollte es geben Sie mir, dass die Taste engster td mit Benutzername und PasswortIch möchte die nächste td finden, wenn die Schaltfläche in diesem tr geklickt wird
$(document).ready(function() {
$(".jsLoginButton").each(function() {
$(this).click(function() {
//Get login details
configuration.loginPage.LOGIN_ID = $('.loginID').closest('td').filter(':first').text();
configuration.loginPage.LOGIN_PASSWORD = $('.loginPassword').closest('td').filter(':first').text();
});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<table>
<thead>
<tr>
<th style="padding: 3px">Username</th>
<th style="padding: 3px">Password</th>
<th style="padding: 3px">Action</th>
</tr>
</thead>
<tr>
<td style="padding: 3px" class="loginID">[email protected]</td>
<td style="padding: 3px" class="loginPassword">Asdf1234!</td>
<td style="padding: 3px">
<button class="jsLoginButton">login</button>
</td>
</tr>
<tr>
<td style="padding: 3px" class="loginID">[email protected]</td>
<td style="padding: 3px" class="loginPassword">Asdf1234!</td>
<td style="padding: 3px">
<button class="jsLoginButton">login</button>
</td>
</tr>
</table>
JS Fiddle https://jsfiddle.net/parag_bandewar/c8w73rup/
Welche td wünschen Sie? –
Nächste nach oder vor? –
Wenn ich auf den zweiten Login-Button klicke, sollte er [email protected] und nicht [email protected] wählen. –