I have a table with inputs and I would like to click on a button and then get the values of some inputs. I just don 't understand how to get there in an easy way as my code is returning undefined all the time.

Code for the table:

```
<table align="center" class='hovertable' width="90%">
    <tr>
        <div class='line' name='div1'>
            <input id='' class='rpiid' type='hidden' name='rpiid[0]' value='00000000c83de86' />
            <input id='' class='sensor_id' type='hidden' name='sensor_id[0]' value='1' />
            <input id='' class='when' type='hidden' name='when[0]' value='2014-02-24 05:00:03' />
            <td align='center'>2014-02-24</td>
            <td>
                <input id='' class='val_displayed' type='text' name='val[0]' value='0366167' />
            </td>
            <td>
                <input id='' class='train' type='checkbox' name='train[0]' value='True' />
            </td>
            <td>
                <input id='' class='valid' type='checkbox' name='valid[0]' value='True' />
            </td>
            <td>
                <button id='0' class='submit_button' type='submit' name='button' value='update'>update</button>
            </td>
        </div>
    </tr>
    <tr>
        <div class='line' name='div2'>
            <input id='' class='rpiid' type='hidden' name='rpiid[1]' value='00000000c83de86' />
            <input id='' class='sensor_id' type='hidden' name='sensor_id[1]' value='1' />
            <input id='' class='when' type='hidden' name='when[1]' value='2014-02-25 05:00:03' />
            <td align='center'>2014-02-25</td>
            <td>
                <input id='' class='val_displayed' type='text' name='val[1]' value='0366132' />
            </td>
            <td>
                <input id='' class='train' type='hidden' name='train[1]' value='False' />
                <input id='' class='train' type='checkbox' name='train[1]' value='True' />
            </td>
            <td>
                <input id='' class='valid' type='hidden' name='valid[1]' value='False' />
                <input id='' class='valid' type='checkbox' name='valid[1]' value='True' />
            </td>
            <td>
                <button id='1' class='submit_button' type='submit' name='button' value='update'>update</button>
            </td>
        </div>
    </tr>
</table>

```

Code for jquery:

```
$(document).ready(function () {
    $('.submit_button').click(function () {
        var val = $(this).closest('.when').attr('value');
        alert('the value is ' + val);
        return false;
    });
});

```

The jsfiddle:
<http://jsfiddle.net/starcraft04/BLCJ5/10/>

Thanks if you can help,

John.