<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="js/jquery-1.12.1.js"></script>
<script type="text/javascript">
$(function() {
//基本选择器
//1. * 代表所有的选择器
// $("*").css("border", "1px solid red");
//2. .class表示类选择器
// $(".astyle").css("border", "1px solid red")
//3. #id 表示id选择器 = getElementById("id")
// $("#li3").css("border", "1px solid red");
//4. $("div") 元素选择器
$("li").css("border", "1px solid red");
});
</script>
</head>
<body>
<ul>
<li>1. <a href="http://localhost">超链接1</a></li>
<li>2. <a href="www.baidu.com">超链接2</a></li>
<li id="li3">3. <a href="#">超链接3</a></li>
<li>4. <a href="#" class="astyle">超链接4</a></li>
</ul>
<div>
<textarea rows="2" cols="2"></textarea>
<input />
</div>
</body>
</html>
JQuery中基本选择器
最新推荐文章于 2022-08-01 14:22:34 发布