jQuery的选择器应用

Original 2019-01-02 15:57:47 196
abstract:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>Document</title><script type="text/javascript" src="js/jquery-3.3.1.min.js"

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Document</title>

<script type="text/javascript" src="js/jquery-3.3.1.min.js"></script>

<script type="text/javascript">

$(document).ready(function(){

$('div').css('background','red');

$('div>ul').css('list-style','none');

$("li:odd").css('color','blue');

$('ul>li:last').css('background','blue');

$('li:first').css('background','pink');

$('li:even').css('color','green');

})


</script>


</head>

<body>

<div>

<ul>

<li>1</li>

<li>2</li>

<li>3</li>

<li>4</li>

<li>5</li>

<li>6</li>

<li>7</li>

</ul>

</div>

</body>

</html>

选择器有常规选择器/顺序选择器/层级选择器/表单属性选择器

Correcting teacher:韦小宝Correction time:2019-01-02 16:33:32
Teacher's summary:写的不错!选择器不管是在js中还是jQuery以及css中都是必须要使用到的!这个必须得好好掌握!

Release Notes

Popular Entries