각 li 값에 특정 설명이있는 간단한 필터 시스템을 만들고 있습니다. 현재 IF 문과 함께 작동하지만 스위치로 변환하고 싶습니다. 이것이 가능한가?클릭하면 jquery : 전환 할 경우
미리 감사드립니다.
내 코드 :
$("ul.simplefilter").on('click', 'li', function (e) {
if($(this).text() == "Iedereen"){
$("#uitleg p").remove();
$("#uitleg").append("<p>Iedereen</p>");
}
else if($(this).text() == "Coach studentenparticipatie"){
$("#uitleg p").remove();
$("#uitleg").append("<p>Coach studentenparticipatie</p>");
}
else if($(this).text() == "Communicatie"){
$("#uitleg p").remove();
$("#uitleg").append("<p>Communicatie</p>");
}
else if($(this).text() == "Coördinator"){
$("#uitleg p").remove();
$("#uitleg").append("<p>Coördinator</p>");
}
})
'switch ($ (this) .text)'및 대소 문자가 case 'Iedereen': '등이됩니다. – abhishekkannojia
가정합니다. '$ ('# uitleg'). html ('
'+ $ (this) .text() + '
'); – Tushar