Reputation: 198
I would like to add some HTML after a link that has a specific class.
Well - this does not work:
a.mylinkclass:after {
content: "<div class='uk-badge'>Test</div>";
color: green;
}
content
does not allow HTML. So what other possibilities do I have to add HTML to a link with a specific tag?
Upvotes: 0
Views: 39
Reputation: 795
You could use JavaScript, instead of CSS, to add the HTML after the link.
For example, you could use JQuery to do it: (as i see your question is tagged with)
$("a.mylinkclass").after("<div class='uk-badge'>Test</div>");
Upvotes: 1
Reputation: 146269
You may try something like this (using jQuery
)
$("<div class='uk-badge'>Test</div>").insertAfter('a.mylinkclass');
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href='' class='mylinkclass'>mylinkclass 1</a>
<a href='' class='myotherclass'>myotherclass</a>
<a href='' class='mylinkclass'>mylinkclass 2</a>
<a href='' class='myotherclass'>myotherclass</a>
Upvotes: 1