I want to remove the tags and spaces: "&#160",<br> and <p></p> from my content.

I tried below removing p and br tags :

let Desc=  response[i].Description.replace(/<p><br[\/]?><[\/]?p>/g,""');

but it is not removing br and p tags .

Could anyone pls help on how to remove tags and spaces.

1 Answer 1


Try something like:

var Desc = $(response[i].Description).text();

.text() function allows to extract text content from HTML.

If this doesn't work for you then try any of below solutions:

  1. Strip HTML from Text JavaScript
  2. Strip HTML Tags in JavaScript
  • Hi @Swetha have you tried this solution? Is it working for you? Commented Nov 30, 2020 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.