---
title: "jquery常见用法"
author: "icarusliu"
date: "2009-04-01T16:10:33Z"
tags: ["jQuery"]
slug: "jquery"
draft: false
lastmod: "2009-04-01T16:10:33Z"
id: 359157
url: "https://icarusliu.iteye.com/blog/359157"
---

- $(a,b)

a:用来查找的字符串

b:用来查找的范围（上下文）

例：$("input:radio", document.forms\[0]) 在文档的第一个表单中，查找所有的单选按钮(即: type 值为 radio 的 input 元素)。

- $(attribute,value)

例：$("input\[name='newsletter']").attr("checked", true);

      $("input\[name!='newsletter']").attr("checked", true);

- $(a).hide(),$(a).show()