jQuery 1.4 removeClass();
은 이제 인수로 함수를 사용하기 때문입니다.removeClass() 콜백 함수를 사용하는 방법은 무엇입니까?
내 <body>
태그는 예를 들어 여기에 추가 된 몇 가지 클래스가 있습니다
removeClass()
에서 함수가 나를 도울 수 있다고 생각하지만, 나는 '돈
<body class="heading-helvetica para-georgia pattern-flowers">
사실 the documentation on the jQuery site을 이해하지 못하고 Regex에 대해 잘하지 못했습니다.
예 : heading-helvetica
을 heading-myriad
또는 para-georgia
과 para-times
등으로 대체하려면 어떻게해야하나요?
내가 이전에 교체하려고하는 클래스 이름이 클래스 이름의 목록에있는 첫 번째 경우에만 작동이 같은 것을 사용했다 : 당신이 그들 모두를 처리하려면
$('#headings li').click(function(){
var this_class = $(this).attr('id');
$('body[class|="heading"]').removeClass();
$('body').addClass(this_class);
});
'$ ('something '). removeClass ('heading-helvetica '). addClass ('heading-myriad ');'. 이 방법이 효과가 없을만한 이유가 있습니까? – rossipedia