2012-04-02 13 views
0

私は、オートプレインボックスの後に2つの入力ボックスを選択するのが好きです。 問題は、オートクレーモ後に入力ボックスを選択できないことです。Jquery UIオートコンプリート、レスポンス後に次の入力を選択

<script> 
$('.autocomplete').die('focus').live('focus', function(){ 
    $(this).autocomplete({ 
     source: 'handler.php?event=autocomplete', 
     delay: 500, 
     minLength: 2, 
     select: function(event, ui) { 
      $(this).attr({"rel" : ui.item.id, "title" : ui.item.title}); 
      $.post('handler.php?event=get_details', 'id='+ui.item.id, function(ret){ 
       $(this).next('input').val(ret.unit); 
       $(this).next('input').val(ret.min_amount); 
      }); 
     } 
    }); 
}); 

<table> 
<tr> 
    <td><input type="text" name="item[]" size="30" value="" class="autocomplete" /></td> 
    <td><input type="text" name="unit[]" size="1" value=""></td> 
    <td><input type="text" name="min_amount[]" size="5" value=""></td> 
</tr> 
<tr> 
    <td><input type="text" name="item[]" size="30" value="" class="autocomplete" /></td> 
    <td><input type="text" name="unit[]" size="1" value=""></td> 
    <td><input type="text" name="min_amount[]" size="5" value=""></td> 
</tr> 

答えて

0

これを試してみてください。助けを

$(this) 
    .parent() 
    .next() 
    .children('input') 
    .val(ret.unit) 
    .end() 
    .next() 
    .children('input') 
    .val(ret.min_amount); 
+0

感謝を! –

関連する問題