To insert an html element before specified html element, insertBefore()
method can be used.
<script>
$("h1").insertBefore("#div3");
</script>
Above code snippet will insert “h1” element before the element whose id is “div3”.
Here, we have used element selctor and id selector.
Views: 4694 | Post Order: 54