子标签(children element)
。例如,本次挑战中文本为 "#target1"、"#target2" 和 "#target3" 的按钮都是<div class="well" id="left-well">
标签的子标签
。
jQuery 有一个children()
方法,可以访问被选取标签的子标签。
下面的代码展示了用children()
方法把left-well
标签的子标签的颜色设置成蓝色(blue)
:
$("#left-well").children().css("color", "blue")
right-well
标签的所有子标签颜色设置成橙色(orange)
。
#right-well
所有的子标签文本应该是橙色。
testString: assert($("#right-well").children().css("color") === 'rgb(255, 165, 0)');
- text: 应该用children()
方法修改标签。
testString: assert(code.match(/\.children\(\)\.css/g));
- text: 仅用 jQuery 给标签添加类。
testString: assert(code.match(/