Below is the code to decode the html entities using javascript rather than the Server side scripting
function decodeEntities(input) {
var y = document.createElement('textarea');
y.innerHTML = input;
return y.value;
}
Above function just receives the html values like below
var str = "<p>Hello World<br />This is the test message";
When we pass the above HTML string to the function it returns as below,
calling the JAVASCRIPT function
decodeEntities(str)
Output is: "<p>Hello World<br/>This is the test message";
function decodeEntities(input) {
var y = document.createElement('textarea');
y.innerHTML = input;
return y.value;
}
Above function just receives the html values like below
var str = "<p>Hello World<br />This is the test message";
When we pass the above HTML string to the function it returns as below,
calling the JAVASCRIPT function
decodeEntities(str)
Output is: "<p>Hello World<br/>This is the test message";
No comments:
Post a Comment