0

I have links that, on hover, will display "bar" after.

.link
{
   color:aqua;
   text-decoration: none;
   background-color: none;
}

.link:hover span {display:none;}
.link:hover::after {content: attr(data-content) 'bar';}

enter image description here

My objective is, on document load, to attach "foo" to in front of "bar" in the content. I have referred to this previous question for help, but cannot seem to find a solution. This did not work:

$(document).ready(function($){
     $('.link').attr('data-content','foo');
 });

Any suggestions on what is going wrong would be highly appreciated. How can I change the content of .link on document load?

iskandarblue
  • 7,208
  • 15
  • 60
  • 130

0 Answers0