I have the following code snippet to convert html to javascript, but I seem to be facing an issue with the output when bound to a textarea and I am not able to figure out what the issue could be.
var html_to_text = $('#source').val().replace(' ', ' ').replace(/<[^>]*>/g, '').replace(/(<br>)+/g, '<br>');
The output is correct when displaying on an alert, but, when the same is bound to a text area, there is a lot of white space on it. Could someone help me understand what could be the issue with the above snippet.
I have a working sample of the same at http://jsfiddle.net/technicaliti/uuxDx/