$('body').on('click', '.datepicker', function () { console.log($(this).closest("input")) })
foreach ($arResult["GRID"]["ROWS"] as $k => $arItem):
<table class="item_basket"> <tr id="<?=$arItem['ID']?>"> <td> c <input class="datepicker" id-datepicker="<?=$arItem['ID']?>" type="text" value=""> до <input class="datepicker" id-datepicker="<?=$arItem['ID']?>" type="text" value=""> </td> </tr> </table>
endforeach;
$(this).siblings("input")