---
title: "jQuery选择器中含有空格和没有空格的区别"
author: "dsr_22"
date: "2011-06-21T11:12:55Z"
tags: ["jQuery"]
categories: ["Web前端"]
slug: "jquery"
draft: false
lastmod: "2011-06-21T11:12:55Z"
id: 1099501
url: "https://dsr-22.iteye.com/blog/1099501"
---

jQuery选择器中含有空格和没有空格的区别

 

举例说明：

有如下两个jQuery表达式

$(".active :hidden")带空格的选择器，表示后代选择器，选择带有样式active内的所有隐藏的子对象。

$(".active:hidden")不带空格的选择器，表示筛选，选择带有样式active并且隐藏的对象。