jQuery 基础

jQuery全局命名空间中定义的唯一两个变量  jQuery $

$(document).ready(fn);//== 在DOMContentLoaded时触发,浏览器不支持时,会在load时触发
$(fn)
jQuery.noConflict();//还原$()为初始值

 jQuery对象返回的类数组对象,拥有length属性,包含selector(选择字符串),context(对象上下文),jquery(jQuery版本号,用于区分jquery对象)

常见API

.each(): Iterate over a jQuery object, executing a function for each matched element.

在回调函数中调用return false来终止循环

.map() Pass each element in the current matched set through a function, producing a new jQuery object containing the return values.

.index() : Search for a given element from among the matched elements.

 If the element is not found, .index() will return -1.

is() : Check the current matched the set of elements against a selector, element, or jQuery object and return true if at least one of these elements matches the given arguments.

原文地址:https://www.cnblogs.com/goOtter/p/9533441.html