jquery addClass() to first position of multiple classes

后端 未结 6 1355
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-11 16:04

what it does:

$(\'p\').addClass(\'bar\');

output:

<
6条回答
  •  甜味超标
    2020-12-11 16:44

    This should not be a dependency for you in any way at all because of the limited control you have over the className string, but you can do this:

    $("p").removeClass('foo').addClass('bar foo');
    

提交回复
热议问题