Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   Поясните пару строк в функции (https://javascript.ru/forum/jquery/15247-poyasnite-paru-strok-v-funkcii.html)

DeL90 18.02.2011 23:08

Поясните пару строк в функции
 
$items.each(function(i){
var $item = $(this);
$item.data('idx',i+1);//??? что происходит здесь
 
$item.bind('click',function(){
var $this       = $(this);
$cn_list.find('.selected').removeClass('selected');
$this.addClass('selected');
var idx         = $(this).data('idx');//??? и здесь
.......
});
});


Поясните две строки с коментами,пожалуйста

SkyLight 18.02.2011 23:25

А это для кого написано?


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