How to decode HTML entities using jQuery?

Decoding of HTML entities encoded string will be required specially during the AJAX operation. During AJAX operation, if we get HTML entities encoded string, it is required to be decoded before displayed to users. If you want to display HTML entities encoded string in textarea, then you can use following code,

var decode = $('<textarea/>').html(encoded).val();

If you want to display HTML entities encoded string in div, then you can use following code,

var decode = $('<div/>').html(encoded).text();