ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] ## .filter() ### 示例 #### 选择单数 ``` // 匹配所有单数DOM $('li').filter(':even').css('background-color', 'red'); ``` #### 过滤函数 ``` $('li').filter(function(index) { return index == 1 || $(this).attr("id") == "fourth"; }).css('background-color', 'red'); ``` ## .find() 所选元素中找匹配的元素 ### 示例 ``` $('li.item-ii').find('li').css('background-color', 'red'); ``` ## .has() 所选元素中如果符合`.has()`条件的元素做处理 ### 示例 ``` $('li').has('ul').css('background-color', 'red'); ```