To place content before a specific html element, before()
method can be used.
<script>
$("h1").before("<h2>This should not be at the top</h2>");
</script>
Above code snippet will place the specified text (<h2>This should not be at the top</h2>) before “h1” element of the web page.
Views: 5967 | Post Order: 49