Given a button
<button href="#" class="search  no-style search-active" style="display: inline-block;">
 <div class="pointer" style="display:none">::after</div>
</button>
that when triggered, the pseudo :after class needs to have a class search-active toggled that sets a background color for the button
.primary .search:after,
.primary .search[data-search="disabled"]:after {
  color: #fff;
  content: "\E8B6";
  font-family: "Material Icons";
  position: absolute;
  top: -25px;
  transition: color .3s;
  font-size: 26px;
  margin-left: -10px;
}
//THIS NEEDS TO BE APPLIED TO THE :after PSEUDO CLASS TO SET THE BACKGROUND COLOR OF THE BUTTON
.search-active {
  background-color: purple;
  padding: 12px 33px 19px 35px;
  margin: 0px -30px;
}
I have similar jquery working for another button, but this doesn't seem to be working for this particular instance:
$(".search").on("click", function() {
  $(this).toggleClass('search-active');
});
JSFIDDLE:https://jsfiddle.net/xk9hx9j9/2/
 
    