예를 들어,이 jQuery를 기능이 있습니다
function example(){
var trigger = $('.image');
trigger.each(function(e){
// here I want to change the background color of the :after pseudo-element
$(this:after).css('background-color', 'red');
//^the above obviously doesn't work
});
}
어떻게 추가, 변경 또는 CSS가 $(this)
의 의사 요소에 속성을 제거 할 수 있습니까?
제이슨, 중복이 아닙니다. 복제본은 단지 의사 요소의 내용을 변경하도록 요청합니다. CSS 속성을 변경하고 싶습니다 –
클래스를 토글하고 관련 CSS 규칙을 사용하여'$ (this) .addClass ('red');와 CSS의 .image.red : {background- color : red;}' –