0

Can you please take a look at this demo and let me know why I am not able to select the after content

$("#yellow::after").on("click", function(){
    alert("The after was clicked.");
});
div{background:yellow; height:200px; width:200px; margin-left:-210px;}
div::after {
  content: "Content";
    background-color:red;
   margin-left:200px;
    
    padding:15px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="yellow">
  hi
</div>
Behseini
  • 6,066
  • 23
  • 78
  • 125

1 Answers1

1

Try this :

$("#yellow").after().on("click", function(){
alert("The after was clicked.");
});

Example : http://jsfiddle.net/Lx65bwzt/1/

DinoMyte
  • 8,737
  • 1
  • 19
  • 26