bootstrap推出一系列的class名称,例如col-md-*、btn-*等等,有时候就会有想要将这一类className删掉的冲动~
那咋样才能妥妥的实现呢?你是不是已经看到下面答案了,诶诶..那么心急
//方法一
$("#hello").removeClass (function (index, css) {
    return (css.match (/(^|\s)color-\S+/g) || []).join(' ');
});
//方法二
$('div').attr('class',function(i, c){
    return c.replace(/(^|\s)color-\S+/g, '');
});

 

相关文章:

  • 2021-09-04
  • 2021-12-27
  • 2021-05-23
  • 2021-05-27
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-04-10
  • 2022-02-14
  • 2021-10-31
  • 2022-12-23
  • 2022-01-08
  • 2021-09-07
  • 2021-12-21
相关资源
相似解决方案