I am trying to write a custom String.Prototype function:
String.prototype.Apos = function () {
var string = this.innerHTML.toString();
return string.replace(/’/g,"'").replace(/“|â€/g,'"');
};
I really just want to write a utf8 string to the browser using javascript, however using decodeURIComponent
wont work and so I have just resorted to replacing the apostrophes myself.
So from the examples I've seen I wrote the above function, however it doesnt seem to return anything. When I run the following:
$("span").html(string.Apos);
I don't get a response. I've never written a custom prototype function before so could someone help me out and tell me where Im going wrong?