noobie q

noobie q

Hey, I deal with networking most of the time so dont kill me please :D,

I have this little problem. I have a submit and a function that I bind to it after clicked. It is supposed to take a value of a textfield that precedes the submit in the table and then do something with it. I really dont know why but I am still getting "undefined". I read some around  but couldnt find anything. I guess I will ask a fellow programmer...Of course after clicking each of those submits I need to get the val() of the corresponding textfield that precedes the given submit. 
note : //of course I have the right includes above but not pasting them here
  1. <script type="text/javascript"> 
  2. $(document).ready(function (){
  3. var dohl= $(':submit.dohl');

  4. dohl.click(function(){
  5. alert($(this).prev('input').val());
  6. var myval=$(this).prev('input').val();
  7. //window.open('dohl.php?param=' + myval ,'Found', 'width=400,heigth=200');
  8. return false;

  9. })
  10. });
a chunk of my html: 
<table><tr><th>Id 1 </th>

    <td><input type="text" name="id_1" value="first" class="dohl"/></td>
     
    <td><input type="submit" name="dohl" value="search" class="dohl"/></td>
</tr>
<tr><th>Id 2 </th>
    <td><input type="text" name="id_2" value="druhy" class="dohledat"/></td>
     
    <td><input type="submit" name="dohl" value="search" class="dohl"/></td>
  </tr>
</table>



Thank you all a lot