blog post

Remove span tag in div using jquery:
you can use this script to remove span tag below mention as follows:
You could try something like this:

 <script type="text/javascript">
        $(document).ready(function () {
           
            var divhtml = $(".divewithspan").clone();
            divhtml.find("span").remove();

            $(".divwithoutspan").html(divhtml);

        });
    </script>

Source Code


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Remove Tags from div</title>
  <script src="//code.jquery.com/jquery-1.11.3.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {
           
            var divhtml = $(".divewithspan").clone();
            divhtml.find("span").remove();

            $(".divwithoutspan").html(divhtml);

        });
    </script>
</head>
<body align="center">
    <div class="divewithspan">This div have span tag: <span>I am span</span></div><br /><br />
    <div class="divwithoutspan"></div>
</body>
</html>

Remove span tag in string using jquery
  • Share This Story


Pleas give your valuable comments to improve the contents.

about author

Atul kumar shukla


I'm Atul Kumar Shukla, working as a web developer.
Welcome to my Blog. This is my personal blog where i post my own questions and answers , articles about ASP.Net., SQL Server, HTML, CSS, Jquery and many more..

Visit Profile

Comments (9)

  • Belue

    Saturday, 22 October, 2016 10:13 AM

    Nice

  • Givens

    Monday, 12 September, 2016 04:40 PM

    Superb !!

  • Flinn

    Thursday, 08 September, 2016 07:34 AM

    Thank you

  • JimmiXS

    Monday, 08 August, 2016 11:43 AM

    nice

  • Mark

    Friday, 13 May, 2016 04:32 AM

    Nice, Thanking you

  • Lipinski

    Monday, 28 March, 2016 06:31 AM

    Superb !!

  • Ratliff

    Thursday, 17 March, 2016 09:50 AM

    Nice

  • Huntington

    Saturday, 29 August, 2015 07:30 PM

    This permits your telephone to function virtually completely like a mini notebook.

  • Knutson

    Monday, 24 August, 2015 02:13 AM

    Hello admin, i see your site needs fresh articles. If you are too lazy to write unique articles everyday you should search in google for: Ightsero's Essential Tool

Leave a comment

Name
E-mail
Url
Message

Get More Stuff
Subscribing to the TheOneblogs newsletter and get intersting stuff and updates to your email inbox.
Your Email

 

Style Switcher

Change Color

×! We use cookies to improve your user experience. More information