0

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

NullReference
  • 4,404
  • 12
  • 53
  • 90

1 Answers1

3

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();

Community
  • 1
  • 1
Sterling Beason
  • 622
  • 6
  • 12