본문 바로가기

자바스크립트

210201 jquery not this

 

EX1) ul li 로 만든 리스트에서 swipeleft 했을 때 해당 li의 자식 요소인 del 클래스를 보여주고 그 외의 다른 li의 del 클래스는 숨김

$("li").on("swipeleft",function(){
	$(this).children('.del').show();
	$('li').not(this).children('.del').hide();
});

 

EX2) 래디오 버튼 클릭 했을 때, 클릭한 래디오 버튼 제외한 나머지는 체크 해제

attr = $('input:radio');
attr.on('change', function() {
    attr.not(this).prop('checked',false);
});
728x90