How do I delete pseudo-elements with jquery.
I tried before:
$('.myclass a:after').hide();
and it's not working like that.
You can't modify the pseudo elements
directly using scripts, but you can use some workarounds.
One of them is to use a class like
$('button').click(function() { $('.myclass a').addClass('hide-after'); })
.myclass a:after { content: '++' } .hide-after:after { display: none }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div class="myclass"> <a>something</a> </div> <button>Test</button>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.