jquery在最后增加一行信息的方法:1、使用“$(元素)”语句匹配想要增加信息的元素对象;2、利用append()方法在元素的最后增加一行信息,语法为“元素对象.append("要增加的信息");”。

本教程操作环境:windows7系统、jquery1.10.0版本、Dell G3电脑。
jquery怎样在最后增加一行信息
在jquery中可以使用append() 方法在最后增加一行信息,append() 方法在被选元素的结尾(仍然在内部)插入指定内容。
该方法的语法为:
$(selector).append(content)
其中content表示要在最后一行添加的内容。
下面通过示例我们来看一下:
<script></script><script>
$(document).ready(function(){
$("button").click(function(){
$("p").append(" <p>这是在最后添加的一行信息");
});
});
</script><p>这是初始的一行信息</p><div class="aritcle_card flexRow artxards">
<div class="artcardd flexRow">
<a class="aritcle_card_img" rel="nofollow" href="/xiazai/gongju/2331" title="jQuery 1.12.4"><img
src="https://img.php.cn/upload/manual/001/431/639/6a21619eac924328.png" alt="jQuery 1.12.4" onerror="this.onerror='';this.src='/static/lhimages/moren/morentu.png'" ></a>
<div class="aritcle_card_info flexColumn">
<a rel="nofollow" href="/xiazai/gongju/2331" title="jQuery 1.12.4" class="overflowclass">jQuery 1.12.4</a>
<p class="overflowclass">jQuery 1.12.4是jQuery 1.x系列的最后一个正式稳定版本,由jQuery团队于2016年发布。该版本主要面向需要兼容旧版浏览器环境的网站和Web应用,尤其适用于仍需支持Internet Explorer 6、Internet Explorer 7、Internet Explorer 8等老旧浏览器的项目。</p>
</div>
<a rel="nofollow" href="/xiazai/gongju/2331" title="jQuery 1.12.4" class="aritcle_card_btn flexRow flexcenter"><b></b><span>下载</span>
</a>
</div>
</div>
<button>在每个 p 元素的结尾添加内容</button>
输出结果:

点击按钮之后:

相关视频教程推荐:jQuery视频教程










