3

I'm using some special characters and they aren't displayed correctly, I don't know why!

I defined it like this :

var grade_value = 'Wešto izšamešđu';

and later I do this:

$('.list').append(
        "<p class='txt'>"+ grade_value + "</p>" 
);

This looks like this: Picture

What could be the problem, here I can't encode using utf-8 or anything like that?

1 Answers1

0

Try This....

var htmlVal=$("<div/>").html(grade_value).text();

$('.list').append(
        "<p class='txt'>"+htmlVal  + "</p>" 
);
amrit sandhu
  • 128
  • 4
  • I use like that but it isn't working , but I just didn't include the whole code. Thank you for your answer –  Apr 05 '16 at 09:20