欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery中insertAfter()方法用法實(shí)例

 更新時(shí)間:2015年01月08日 15:03:59   投稿:shichen2014  
這篇文章主要介紹了jQuery中insertAfter()方法用法,實(shí)例分析了insertAfter()方法的功能、定義及匹配的元素插入到另一個(gè)指定的元素集合后面的使用技巧,需要的朋友可以參考下

本文實(shí)例講述了jQuery中insertAfter()方法用法。分享給大家供大家參考。具體分析如下:

此方法把匹配的元素插入到另一個(gè)指定的元素集合的后面。
insertAfter()方法與insertBefore()方法的作用相反。

語(yǔ)法結(jié)構(gòu):

復(fù)制代碼 代碼如下:
$(selector).insertAfter(content)

參數(shù)列表:

參數(shù) 描述
selector 定義要被插入的內(nèi)容。
content 定義在哪些元素之后插入內(nèi)容。

實(shí)例代碼:

復(fù)制代碼 代碼如下:

<!DOCTYPE html>
<html>
<head>
<meta charset=" utf-8">
<meta name="author" content="http://www.dbjr.com.cn/" />
<title>insertAfter()函數(shù)-腳本之家</title>
<style type="text/css">
p{
  width:100px;
  height:100px;
  border:1px solid red;
}
div{
  width:200px;
  height:200px;
  border:1px solid blue;
}
</style>
<script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $("div").insertAfter("p");
  })
});
</script>
</head>
<body>
<div>我的前面會(huì)被插入內(nèi)容</div>
<p>我是p元素</p>
<button>點(diǎn)擊查看效果</button>
</body>
</html>

以上代碼可以將div元素插入到p元素的下面,當(dāng)然是外部的下面。

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論