移除元素css后的::

jQuery Removing ::after css from an element

本文关键字:后的 css 元素      更新时间:2023-09-26

我有一个这样的css:

.support-hub .app-detail:after {
    content: "";
    display: table;
    clear: both;
}

Firebug显示为

.support-hub .app-detail::after {
    clear: both;
    content: "";
    display: table;
}

在我的代码中,我这样做:

$('.support-hub .app-detail:after').css({'display':'inline'});

但是display属性没有改变。请帮助。

一个快速的解决方案是将::after或::before样式应用于类(而不是主元素),并删除e类

你可以添加以下代码到你的css:

.support-hub .app-detail.inline:after {
    content: "";
    display: inline;
    clear: both;
}

你可以从javascript调用this:

$('.support-hub .app-detail').addClass('');

您不能这样使用after。从技术上讲,DOM元素不能被jQuery访问。

就像这样试试

$('.support-hub .app-detail').css({'display':'inline'});

或者您可以使用next jQuery方法或类似的方法来操作DOM元素。

$('.support-hub .app-detail').next().css({'display':'inline'});

请参考此链接