小编And*_*y89的帖子

在点击事件时使用jQuery在类之间交替

我在这里感觉非常愚蠢 - 我无法在jQuery中使用简单的类切换语句!我只能坐在最后45分钟的挫折中,我搜索了Stack Overflow的问题和答案,但无济于事.

My goal is, upon clicking an item with the colorClick id (already containing a default class of "white"), to rotate that item between being assigned the class green, yellow, orange, red, and back to white again (ad infinitum).

The CSS is simple - each class simply corresponds to a different background color.

The HTML is simple - a div tag with two CSS classes (one static, one to be changed by jQuery).

The jQuery is simple …

javascript css jquery addclass removeclass

8
推荐指数
2
解决办法
781
查看次数

标签 统计

addclass ×1

css ×1

javascript ×1

jquery ×1

removeclass ×1