jQuery find() 及<ul><li>的使用
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> <script type="text/javascript" src="js/jquery-1.7.2.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $("ul.i9").find('li').css('background-color', 'red'); }); }); </script> </head> <body> <button style="width: 10%" >点击</button> <ul class="i0"> <li class="i1">I</li> <li class="i2">II <ul class="i3"> <li class="i4">1</li> <li class="i5">2 <ul class="i6"> <li class="i7">A</li> <li class="i8">B <ul class="i9"> <li class="i10">a</li> <li class="i11">b</li> </ul> </li> <li class="i12">C</li> </ul> </li> <li class="i13">3</li> </ul> </li> <li class="i14">III</li> </ul> </body> </html>
效果图如下所示:
相关推荐
EdwardSiCong 2020-11-23
85477104 2020-11-17
hhanbj 2020-11-17
81427005 2020-11-11
seoppt 2020-09-13
honeyth 2020-09-13
WRITEFORSHARE 2020-09-13
84483065 2020-09-11
momode 2020-09-11
85477104 2020-08-15
83510998 2020-08-08
82550495 2020-08-03
tthappyer 2020-08-03
84901334 2020-07-28
tthappyer 2020-07-25
TONIYH 2020-07-22
tztzyzyz 2020-07-20
83510998 2020-07-18
81463166 2020-07-17