Insert element before
Description
The following code shows how to insert selected content before each of the matched elements.
Example
<html>
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {<!-- w ww . ja v a2 s .com-->
$("p").before($("b"));
});
</script>
</head>
<body>
<body>
<b>java2s.com</b>
<p>java2s.com:</p>
<p>java2s.com 1:</p>
</body>
</html>