2
我有以下幾點:如何檢測類的存在並添加或刪除其他類?
<html lang="en" class="no-js theme-light"> or
<html lang="en" class="no-js xxx yyy theme-light">
我願讓這個點擊一個鏈接將其更改爲:
<html lang="en" class="no-js theme-dark">
<html lang="en" class="no-js xxx yyy theme-dark">
再次點擊將其改回。即刪除theme-dark
並添加theme-light
。
有人可以解釋我怎麼能用jQuery
做到這一點?
$('#sidebar-theme-switch').click(function (e) {
???
});