Unicode in data-content for pseudo element content

RedHatter

I would like to put unicode in the data-content attribute using JQuery so as to use it for pseudo element content, but I can't find the right format. How do you display unicode? The fallowing just displays ▼.

a::after
{
    content: attr(data-content);
}
<a href="...">...</a>
$("a").attr ("data-content", "&#x25BC;");
LcSalazar

Insert in this format, using the \u that, in Javascript, denotes an Unicode number inside a string literal

$("a").attr ("data-content", "\u25BC");

From MDN Unicode escape docs:

You can use the Unicode escape sequence in string literals, regular expressions, and identifiers. The escape sequence consists of six ASCII characters: \u and a four-digit hexadecimal number. For example, \u00A9 represents the copyright symbol. Every Unicode escape sequence in JavaScript is interpreted as one character.

$("a").attr ("data-content",  "\u25BC");
a::after
{
    content: attr(data-content);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>


<a href="...">...</a>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Pseudo element content with JQuery

From Dev

disable touch on the pseudo content of an element

From Dev

Use content of an element in attr() of pseudo-element

From Dev

before pseudo-element covering inner content

From Dev

CSS Transition on the 'content' property of :before pseudo element

From Dev

Getting pseudo-element content in Chrome

From Dev

CSS Transition on the 'content' property of :before pseudo element

From Dev

Move content added with pseudo-element:after

From Dev

IE 11 considers pseudo content as part of element content

From Dev

Visually hide content but not pseudo content

From Dev

Bind data to content element in Polymer

From Java

What is the ::content/::slotted pseudo-element and how does it work?

From Dev

automate the content value of pseudo element depending which number the child is

From Dev

Change content property of pseudo element within CSS animation

From Dev

How do I style part of the pseudo element content: "..."

From Java

Is there a way to use SVG as content in a pseudo element :before or :after

From Dev

is it possible to animate and remove the pseudo content from a element..?

From Dev

css pseudo-element appearing over top of content

From Dev

Using the :after CSS pseudo-element without inserting content

From Dev

CSS centering content add by pseudo-element after

From Dev

Dynamic styling for pseudo element's content in Vue2.x

From Dev

How to inserted HTML tag from pseudo-element content:

From Dev

Vertically/horizontally centering a pseudo element's generated content

From Dev

Retrieve a pseudo element's content property value using JavaScript

From Dev

Dynamic styling for pseudo element's content in Vue2.x

From Dev

is it possible to animate and remove the pseudo content from a element..?

From Dev

How to inserted HTML tag from pseudo-element content:

From Dev

automate the content value of pseudo element depending which number the child is

From Dev

To hide pseudo class content in a zero-height element on Firefox

Related Related

  1. 1

    Pseudo element content with JQuery

  2. 2

    disable touch on the pseudo content of an element

  3. 3

    Use content of an element in attr() of pseudo-element

  4. 4

    before pseudo-element covering inner content

  5. 5

    CSS Transition on the 'content' property of :before pseudo element

  6. 6

    Getting pseudo-element content in Chrome

  7. 7

    CSS Transition on the 'content' property of :before pseudo element

  8. 8

    Move content added with pseudo-element:after

  9. 9

    IE 11 considers pseudo content as part of element content

  10. 10

    Visually hide content but not pseudo content

  11. 11

    Bind data to content element in Polymer

  12. 12

    What is the ::content/::slotted pseudo-element and how does it work?

  13. 13

    automate the content value of pseudo element depending which number the child is

  14. 14

    Change content property of pseudo element within CSS animation

  15. 15

    How do I style part of the pseudo element content: "..."

  16. 16

    Is there a way to use SVG as content in a pseudo element :before or :after

  17. 17

    is it possible to animate and remove the pseudo content from a element..?

  18. 18

    css pseudo-element appearing over top of content

  19. 19

    Using the :after CSS pseudo-element without inserting content

  20. 20

    CSS centering content add by pseudo-element after

  21. 21

    Dynamic styling for pseudo element's content in Vue2.x

  22. 22

    How to inserted HTML tag from pseudo-element content:

  23. 23

    Vertically/horizontally centering a pseudo element's generated content

  24. 24

    Retrieve a pseudo element's content property value using JavaScript

  25. 25

    Dynamic styling for pseudo element's content in Vue2.x

  26. 26

    is it possible to animate and remove the pseudo content from a element..?

  27. 27

    How to inserted HTML tag from pseudo-element content:

  28. 28

    automate the content value of pseudo element depending which number the child is

  29. 29

    To hide pseudo class content in a zero-height element on Firefox

HotTag

Archive