Reputation: 4484
I'm trying to append the ascii character ⚠
to some element's title attribute.
When I used "jQuery(this)[0].title = title;"
I get the raw values. I've also tried .attr('title', value)
Any idea how to update the title attribute with ascii?
Example jsfiddle example
Upvotes: 0
Views: 87
Reputation: 640
EDIT: After looking at your jsfiddle, I realized what you were encountering and how to fix it. Your selector was incorrect and html() was needed.
$(document).ready(function() {
$("label").each(function(index){
var title = jQuery(this).attr('title');
title += ' ⚠ Stats are incomplete due to the video being recently published'
jQuery(this).html(title);
});
});
UPDATED JSFIDDLE: https://jsfiddle.net/8ze2q0ze/1/
This question has been answered here: HTML Entity Decode
Add the .text() to your variable. Like this:
jQuery(this)[0].title = title.text();
Upvotes: 3