How to strip HTML tags from div content using Javascript/jQuery?

user3418849

I had made one div tag and stored its contents in a variable. If this tag contains p,b or any other tags then it should be removed from string. How can I achieve this?

UmarKashmiri

use the regular expression.

var regex = /(<([^>]+)>)/ig
var body = "<p>test</p>"
var result = body.replace(regex, "");

alert(result);

HERE IS THE DEMO

Hope this helps.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to strip HTML tags from div content using Javascript/jQuery?

From Dev

how to strip all html tags and special characters from string using sql server

From Dev

Strip html tags from array

From Dev

How to extract content of html tags from a string using javascript or angularjs?

From Dev

How to extract content of html tags from a string using javascript or angularjs?

From Dev

How can I strip any and all HTML tags from a string?

From Dev

strip away html tags from extracted links

From Dev

strip html tags from an xpath @attribute

From Dev

Strip content of specific tags

From Dev

How to strip all HTML tags from a string except tags contained inside backticks?

From Dev

how to fetch required content only using strip_tags function in php

From Dev

How to strip all visual composer shortcode/tags from wordpress's post_content fetched with custom query

From Dev

How to create tags from one content to another content using PERL

From Dev

strip_tags - Strip <a> tags from a <img>

From Dev

How can I strip HTML tags that have attribute(s) from string?

From Dev

How to completely strip HTML tags with newlines after them from string created through CKeditor

From Dev

How can I strip HTML tags that have attribute(s) from string?

From Dev

How to append html tags from an div onto another div?

From Dev

How to append html tags from an div onto another div?

From Dev

How to extract content between tags in html using grep command

From Dev

How to strip HTML content in flume morphline.conf file using Xquery

From Dev

Strip HTML tags from within the title and alt attributes of an image tag

From Dev

Strip HTML tags from libreoffice command line conversion

From Dev

Strip all HTML from string, except <mark> tags

From Dev

IIS 8.0 - Strip html tags from url (XSS protection)

From Dev

How to remove all the anchor tags from content using PHP

From Dev

How to remove all the anchor tags from content using PHP

From Dev

Remove all text content from HTML div but keep HTML tags and structure

From Dev

Strip and fetch text content from each nested div on a page

Related Related

  1. 1

    How to strip HTML tags from div content using Javascript/jQuery?

  2. 2

    how to strip all html tags and special characters from string using sql server

  3. 3

    Strip html tags from array

  4. 4

    How to extract content of html tags from a string using javascript or angularjs?

  5. 5

    How to extract content of html tags from a string using javascript or angularjs?

  6. 6

    How can I strip any and all HTML tags from a string?

  7. 7

    strip away html tags from extracted links

  8. 8

    strip html tags from an xpath @attribute

  9. 9

    Strip content of specific tags

  10. 10

    How to strip all HTML tags from a string except tags contained inside backticks?

  11. 11

    how to fetch required content only using strip_tags function in php

  12. 12

    How to strip all visual composer shortcode/tags from wordpress's post_content fetched with custom query

  13. 13

    How to create tags from one content to another content using PERL

  14. 14

    strip_tags - Strip <a> tags from a <img>

  15. 15

    How can I strip HTML tags that have attribute(s) from string?

  16. 16

    How to completely strip HTML tags with newlines after them from string created through CKeditor

  17. 17

    How can I strip HTML tags that have attribute(s) from string?

  18. 18

    How to append html tags from an div onto another div?

  19. 19

    How to append html tags from an div onto another div?

  20. 20

    How to extract content between tags in html using grep command

  21. 21

    How to strip HTML content in flume morphline.conf file using Xquery

  22. 22

    Strip HTML tags from within the title and alt attributes of an image tag

  23. 23

    Strip HTML tags from libreoffice command line conversion

  24. 24

    Strip all HTML from string, except <mark> tags

  25. 25

    IIS 8.0 - Strip html tags from url (XSS protection)

  26. 26

    How to remove all the anchor tags from content using PHP

  27. 27

    How to remove all the anchor tags from content using PHP

  28. 28

    Remove all text content from HTML div but keep HTML tags and structure

  29. 29

    Strip and fetch text content from each nested div on a page

HotTag

Archive