NEED HELP | event.currentTarget.closest() or something similar (.parent ?)

NEED HELP | event.currentTarget.closest() or something similar (.parent ?)

Hello Guys,

I'm totally new to this forum and I appreciate to have the ability to discuss on jQuery and to get answers to my questions.
I don't know that much jQuery and I need to modify some code written by someone that knows a bit more about it.

My code involves a bit of PHP, that calls jQuery plugin functions.

My problem follows...

Code on the client page :
  1. <div>
  2. <?php
  4. foreach ($joueurs as $joueur) {
  5. echo '<form roler="form" id="form'.$joueur['id'].'">
  6.       <table class="table">
  7.       <tr>
  8.       <td><input type="text" id="number" value="'.$joueur['number'].'" maxlength="3" size="1"/></td>
  9.       <td><input type="text" id="special" value="'.$joueur['special'].'" size="5"/></td>
  10.       <td><input type="text" id="name" value="'.$joueur['name'].'"/></td>
  11.       <td><input type="checkbox" class="playBox" '.(($joueur['plays'] == 'yes') ? 'checked' : '').' id="'.$joueur['id'].'"/></td>
  12.       <td><button type="submit" id="id_player'.$joueur['id'].'" class="btn btn-warning modifyPlayer">Modify</button></td>
  13.       </tr>
  14.       </table>
  15.       </form>';
  16. }
  17. ?>
  18. </div>
This makes some tables containing informations inside the " $joueurs" var (from a DataBase).

When I click on a button, I want to get the value of every <input type="text"> related to the same Form that the pressed button comes from, and the "id" of the button pressed (" id_playerXX").

The jQuery code involved, that I want to keep as much as possible, follows :
  1. $('.modifyPlayer').click(function(event) {
  2. var params = {
  3. a: 'mp',
  4. name: $('name').val(),
  5. numero: $('numero').val(),
  6. special: $('special').val(),
  7. id_player:
  8. };
  9. $.post('m.php', params, function(response){
  10. (response == 'ok') ? $("#message").html("Player modified !").fadeIn(2000).fadeOut(2000) : alert('nok');
  11. });
  12. event.preventDefault();
  13. });
I can get the id of the button pressed with " id_player:". It works for me. But I can't get the value of the textboxes of the SAME form than the button pressed.

After a lot of search on the Internet, I imagine that it should be something like " name: event.currentTarget.closest('input#name').val()", and I tried a lot of things, but I can't get it to work.

I appreciate any help from you, even if you don't give me answers to my problem.

Thank you in advance,
Kind regards from France !