jquery的元素选择器

2019-12-25  本文已影响0人  有点皮的小黄皮

jquery的元素选择器

jQuery选择器是使用封装好的sizzle库

/*!
 * jQuery JavaScript Library v3.4.1
 * https://jquery.com/
 *
 * Includes Sizzle.js
 * https://sizzlejs.com/
 *
 * Copyright JS Foundation and other contributors
 * Released under the MIT license
 * https://jquery.org/license
 *
 * Date: 2019-05-01T21:04Z
 */

示例

// 引入Sizzle.js后

var $ = Sizzle;
console.log($('div')) // 输出所有div数组
console.log($('#divid')) // 输出id为“divid”的元素

上一篇 下一篇

猜你喜欢

热点阅读