toggleClass() 把本来的有的类名去掉 本来没有的 加上

连续点击按钮可以交替颜色,就是改变class

 

原文地址:https://www.cnblogs.com/zhang-hong/p/13183922.html