jquery 특정 단어 일괄 바꾸기 채택완료
안녕하세요.
아래와 같이 반복문이 쭉 있습니다.
var 안에 --dark-purple 이 6개 정도 있는데
클릭하면 --dark-purple => --grey-08로 모두 바꾸고 싶습니다.
감사합니다.
// 1장 받기 클릭시 $(document).on('click','.flex.flex-wrap.gap-4.content-start .flex-grow-0.overflow-hidden',function(e){ var idx = $('.flex.flex-wrap.gap-4.content-start .flex-grow-0.overflow-hidden').index(this); select_this = ".flex.flex-wrap.gap-4.content-start .flex-grow-0.overflow-hidden";
//여기에 클릭한곳만 --dark-purple => --grey-08 바꾸기
$(".w-full.h-full.object-cover.object-top").eq(idx).addClass('grayscale'); });
http://sir.kr/data/editor/2411/1888014603_1731473694.9856.jpg" />
답변 1개
※ Click한 부분에 포함된 dark를 grey로 바꾸는 아레의 코드를 추가해 보세요.
$(select_this).each(function() {
$(this).removeClass('--dark-purple').addClass('--grey-08');
});</p>
<p>
> select_this 변수가 정의된 후 바로 아래에 ~
답변에 대한 댓글 2개
$(document).on('click', '.flex.flex-wrap.gap-4.content-start .flex-grow-0.overflow-hidden', function(e) {
var idx = $('.flex.flex-wrap.gap-4.content-start .flex-grow-0.overflow-hidden').index(this);
$(this).css('--dark-purple', 'var(--grey-08)');
$(".w-full.h-full.object-cover.object-top").eq(idx).addClass('grayscale');
});
[/code]
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
class가 아니여서
rgba(var(--dark-purple)
rgb(var(--dark-purple)
이안에 있어서 바뀌지가 않네요