Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Как по клику на инпут достать другой ближайший? (https://javascript.ru/forum/jquery/50879-kak-po-kliku-na-input-dostat-drugojj-blizhajjshijj.html)

tenebrosus 15.10.2014 16:57

Как по клику на инпут достать другой ближайший?
 
$('body').on('click', '.datepicker', function () {
      console.log($(this).closest("input"))
})

Пишет его же, а не предыдущий и не следующий...

рони 15.10.2014 17:18

tenebrosus,
а html?

tenebrosus 15.10.2014 18:11

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;

рони 15.10.2014 19:44

tenebrosus,
$(this).siblings("input")

tenebrosus 15.10.2014 20:45

спс


Часовой пояс GMT +3, время: 06:24.