JQuery常用的api[最好是系统地学习一下《锋利的JQuery》]
text
Get the combined text contents of each element in the set of matched elements, including their descendants后裔, or set the text contents of the matched elements.
html
Get the HTML contents of the first element in the set of matched elements or set the HTML contents of every matched element.
val
Get the current value of the first element in the set of matched elements or set the value of every matched element.
each
.prop()
Get the value of a property for the first element in the set of matched elements or set one or more properties for every matched element.
.parent()
https://api.jquery.com/parent/
Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
.next()
Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
.eq()
Reduce the set of matched elements to the one at the specified index.
.on()
Attach an event handler function for one or more events to the selected elements.
http://live.datatables.net/depawowa/1/edit
jQuery.data()
https://api.jquery.com/jquery.data/
Store arbitrary data associated with the specified element and/or return the value that was set.
Contents:
.toggleClass()
http://api.jquery.com/toggleclass/
Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the state argument.
使用场景http://live.datatables.net/kuwaduta/1/edit
jQuery.each
http://api.jquery.com/jquery.each/
$(this)
https://stackoverflow.com/questions/4735342/jquery-to-loop-through-elements-with-the-same-class
Use each: 'i
' is the postion in the array, obj
is the DOM object that you are iterating (can be accessed through the jQuery wrapper $(this)
as well).
$('.testimonial').each(function(i, obj) {
//test
});
Check the api reference for more information.
最新文章
- XML创建与解析常用方法介绍
- 交换机做Channel-Group
- POJ 2253 Frogger -- 最短路变形
- [SQL]开启事物,当两条插入语句有出现错误的时候,没有错误的就插入到表中,错误的语句不影响到正确的插入语句
- HTML a 标签 下载 apk 文件
- SQL 把查出来的信息整合为一张表
- [转载]介绍一个JSONP 跨域访问代理API-yahooapis
- 冒泡排序和快速排序的java实现
- WPF翻转动画
- 后台进程弹Toast的几种方案
- Laravel使用Seeder自动填充数据
- 这应该是目前最快速有效的ASP.NET Core学习方式(视频)
- SpringBoard 无法启动应用程序(错误:-3)
- Python爬虫入门教程 43-100 百思不得姐APP数据-手机APP爬虫部分
- Docker安装rabbitmq
- Atcoder | AT2665 【Moderate Differences】
- JavaScript编程语言
- Sql_server基本操作
- kafka管理器之kafka-manager
- obv15 实例6:如果K线柱过多,ZIG将发生变动,导致明显的OBV15指标被隐藏!