How to Make jQuery Tooltip Accept HTML Codes

  • by
The default way to populate string in jQuery Tooltip is to treat all strings in title as plain text. If you want it accept HTML tags, here is an code snippet to do it.
$(document).tooltip({
position : {
my : "center bottom-20",
at : "center top",
using : function(position, feedback) {
$(this).css(position);
$("<div>").addClass("arrow").addClass(feedback.vertical).addClass(feedback.horizontal).appendTo(this);
}
},
content: function () {
return $(this).prop('title');
},
});

Leave a Reply

Your email address will not be published. Required fields are marked *