为什么我不能使用以下代码更改每个age="number" ?我的属性()中是否缺少某些内容?
<div id="people">
<li age="number">
<span>22</span>
<span>23</span>
<span>24</span>
<span>25</span>
<span>26</span>
</li>
<li age="number">
<span>22</span>
<span>23</span>
<span>24</span>
<span>25</span>
<span>26</span>
</li>
</div>
$("body").on("click", function(){
var x = $("#people").children( function(){
return $(this).find("span:nth-child(4)").text();
});
$("#people li").attr("age", + x);
});