jQuery index 번호

2022. 9. 8. 12:13카테고리 없음

인덱스 번호 빼기

1.

$(선택자).each(function(index){
	$(this).click(function(e){
    	console.log(index);
    });

2.

$(선택자).click(function(){
	var index = $(this).index('선택자'); //선택자 갯수 숫자 ex) 0 1 2 3 ...
    })