JQuery中基本选择器

来源:互联网 发布:淘宝注册手机号上限 编辑:程序博客网 时间:2024/06/06 18:43
<!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>

0 0
原创粉丝点击