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

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