S
S
Sergey Shilov2013-12-15 22:08:03
css
Sergey Shilov, 2013-12-15 22:08:03

:after pseudo selector in jQuery?

We need to fire a specific event on an element with the :after pseudo-selector.
But the debugger tells me that it's a syntax error.

('div:after').css({'background' : 'black'});

I thought maybe it doesn't recognize this selector at all, I googled it and didn't really find anything.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zyablikov, 2013-12-15
@Olivoin

So you won't be able to do it. You can use an alternative way:

div.bg-black:after {
background-color: black;
}

$("div").addClass("bg-black");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question