jQuery的HTML操作
来源:互联网 发布:mac book 和linux 编辑:程序博客网 时间:2024/05/16 19:32
$(selector).html(content); 修改HTML内容。
$(selector).append(content); 将内容添加所有匹配元素的后面。
$(selector).prepend(content); 将内容添加所有匹配元素的前面。
$(selector).after(content); 将内容添加所有匹配元素的下一行。
$(selector).before(content); 将内容添加所有匹配元素的前一行。
示例:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> <HEAD> <TITLE> New Document </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT=""> <script type="text/javascript" src="jquery-1.6.4.js"></script> <script type="text/javascript">$(document).ready(function(){$("button").click(function(){$("#p1").html("This is another content.");$("#p2").append("This is another content.");$("#p3").prepend("This is another content.");$("#p4").after("This is another content.");$("#p5").before("This is another content.");});}); </script> </HEAD> <BODY> <button type="button">Change</button> <p id="p1">This is a paragraph with little content.</p> <p id="p2">This is a paragraph with little content.</p> <p id="p3">This is a paragraph with little content.</p> <p id="p4">This is a paragraph with little content.</p> <p id="p5">This is a paragraph with little content.</p> </BODY></HTML>
- jQuery的HTML操作
- jquery HTML控件的操作
- JQuery对基本Html控件的操作
- jquery对html标签操作的收集
- jQuery 操作动态加载的html 元素
- jquery的节点操作html text append
- 02. JQuery 对HTML/CSS的操作
- HTML常用的jquery操作-yellowcong
- jQuery HTML 操作
- jQuery操作HTML元素
- JQuery中的HTML操作
- jQuery HTML 操作
- jQuery 中的 HTML 操作
- jQuery HTML 操作
- jQuery操作HTML+CSS
- jQuery HTML 操作
- jQuery中的HTML操作
- jquery操作html元素
- Github快速入门手册
- 有道词典4.4 和 websphere7.0 冲突 Reply.fill() InputStream.read()
- 游戏开发的小决窍
- Linux命令整理(一)
- LINUX学习笔记6——使用GCC编译器
- jQuery的HTML操作
- LINUX学习笔记7——使用GDB程序调试工具
- Android开发之路(三)---模拟打电话的实现
- poj3984--BFS
- Android Mms专题之:Mms概览介绍
- KMP算法C语言的实现
- 交叉工具链制作至尊宝典
- hdu 1312
- LINUX学习笔记8——Makefile工程管理