Description:Selects all elements with the given class. version added:1.0jQuery( ".class" ) class:A class to search for. An element can have multiple classes; only one of them must match. For class selectors, jQuery uses JavaScript's nativegetElementsByClassName()function if the browser supports...
linkSelecting Elements with a Comma-separated List of Selectors 1 $("div.myClass, ul.people"); linkPseudo-Selectors 1 2 3 4 5 6 7 8 9 10 11 12 $("a.external:first"); $("tr:odd"); // Select all input-like elements in a form (more on this below). ...
SelectorExampleSelects * $("*") All elements #id $("#lastname") The element with id="lastname" .class $(".intro") All elements with class="intro" .class,.class $(".intro,.demo") All elements with the class "intro" or "demo" element $("p") All <p> elements el1,el2,el3...
Return the element with id="id01":jQuery myElement = $("#id01"); Try it Yourself » JavaScript myElement = document.getElementById("id01"); Try it Yourself » Finding HTML Elements by Tag NameReturn all <p> elements:jQuery myElements = $("p"); Try it Yourself » ...
// 获取element-ui定义好的scroll盒子 const SELECTWRAP_DOM = el.querySelector('.el-select-dropdown .el-select-dropdown__wrap') SELECTWRAP_DOM.addEventListener('scroll', function () { const CONDITION = this.scrollHeight - this.scrollTop <= this.clientHeight ...
class2type.toString, core_hasOwn = class2type.hasOwnProperty, core_trim = core_version.trim, // Define a local copy of jQuery jQuery = function( selector, context ) { // The jQuery object is actually just the init constructor 'enhanced' return new jQuery.fn.init( selector, context, ...
li> <li class="item-2">2</li> <li class="item-3">3</li> </ul> </li> <li class="item-c">C</li> </ul> </li> <li class="item-iii">III</li> </ul> $('li.item-a').parentsUntil('.level-1').css('background-color', 'red'); parentsUntil([expr|element][,filter...
基本语法:$(selector).action() 二、查询标签选择器和筛选器 1)选择器 基本选择器 $("*") $("#id") $(".class") $("element") $(".class,p,div") 层级选择器 $(".outer div") $(".outer>div") $(".outer+div") $(".outer~div") 基本筛选器 $("li:first") $("li:eq(2)") $...
$("Element:first") 'HTML页面中某类元素的第一个元素 $("Element:last") 'HTML页面中某类元素的最后一个元素 $("Element:not(selector)") '去除所有与给定选择器匹配的元素,如:$("input:not(:checked)") 表示选择所有没有选中的复选框 $("Element:even") '获得偶数行 ...
Description: Selects all elements with the given class. version added: 1.0jQuery( ".class" ) class: A class to search for. An element can have multiple classes; only one of them must match. For class selectors, jQuery uses JavaScript's native getElementsByClassName() function if the ...