Wrap text children
Description
The following code shows how to wrap text children.
Example
<html>
<head>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {<!--from w w w.j a va2 s . c o m-->
$("p").contents().filter(function() {
return this.nodeType != 1;
}).wrap("<b/>");
});
</script>
</head>
<body>
<p>
Hello <span>span</span>data
</p>
</body>
</html>