From this question I learned that the check mark is the code ✔ (0x2714 [HTML decimal: ✔])
. I know that you add text to a span using jQuery by doing $('#spanid').text(texthere);
. I want to add the check mark to the span.
I did it like
$('#spanid').text(✔); //This errors on the `&`
$('#spanid').text(#10004); //This results in `Unexpected token ILLEGAL
What is the correct way of doing this?
Use .html()
. Also, enclose the value in quotes.
$('#spanid').html('✔');
.text()
will convert the input to text string..html()
converts to HTML string/content and the character encoded can be seen.
Fiddle Demo
or if you already have the character ✔
, .text()
would work;
$('#spanid').text('✔');
What I would do is:
$('#spanid').addClass('check');
and add css;
.check:after {
content: '(what ever the code for the check mark is)';
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With