Skip to content Skip to sidebar Skip to footer

JQuery .html() Remove Line Break On IE 8

So I've been trying to decode string with .html() function in jQuery and it work really nice except on IE... Here is the string I have: ééé\r\nà

Solution 1:

Try This:

 var itemDescription = "ééé\\r\\nàà&#224";

Solution 2:

Actually one solution I found is to do something like that:

itemDescription = itemDescription.replace(/(\r\n|\r|\n)/g, '________BREAK________');
var decodedDescription = $("<div>").html(itemDescription).text();
decodedDescription = decodedDescription.replace(/________BREAK________/g, '\r\n');

Post a Comment for "JQuery .html() Remove Line Break On IE 8"