简体   繁体   English

jQuery从元素中删除:: after css

[英]jQuery Removing ::after css from an element

I have css like: 我有像这样的CSS:

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

Firebug shows it as 萤火虫显示为

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

In my code I am doing this: 在我的代码中,我这样做:

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

But that display property is not getting changed. 但是该显示属性未更改。 Pls help. 请帮助。 Very less documentation available for :after css manipulation with jQuery 很少的文档可用于:使用jQuery进行CSS操作后

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

You could not use after like this. 这样after您将无法使用。 Technically DOM elements cannot be accessed by the jQuery with this. 从技术上讲,使用jQuery不能访问DOM元素。

Simply try like this 只需这样尝试

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

Or you may use next jQuery method or something like this to manipulate the DOM elements. 或者,您可以使用next jQuery方法或类似的方法来操作DOM元素。

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

Please refer this Link 请参考此链接

You could add the following code to your css: 您可以将以下代码添加到CSS中:

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

And you could call the this from javascript: 您可以从javascript调用此代码:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM