insert

UK[?n?s?:t] US[?n?s?:rt]

vt.Insert; embed; (in the article) add; insert

n. Insertion; addition (especially a small picture inserted or overprinted in a page of printed pictures); insert (of a book or newspaper); addition

before

英[b??f?:(r)]   美[b??f?r,-?for]   

prep.Before...;before,better than;in front of...;with...

conj.Before...;before...;earlier than...;rather than...

adv.before, before; in front, in front

jquery insertBefore() method syntax

Function: insertBefore() method inserts HTML tags or existing elements before the selected element. If this method is used on existing elements, they will be moved from their current position and added before the selected element.

Syntax: $(content).insertBefore(selector)

Parameters:

ParameterDescription
content Required. Specifies the content to be inserted. Possible values: Selector expression HTML tag
selector Required. Specifies where to insert the selected element.

jquery insertBefore() method example

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $("<span>你好!</span>").insertBefore("p");
  });
});
</script>
</head>

<body>
<p>這是一個(gè)段落。</p>
<p>這是另一個(gè)段落。</p>
<button>在每個(gè) p 元素之前插入 span 元素</button>
</body>
</html>
Run instance ?

Click the "Run instance" button to view the online instance