<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="js/jquery-1.7.1.min.js"></script>
</head>
<body>
<ul>
<li>number1</li>
<li>number2</li>
<li>number3</li>
<li>number4</li>
<li>number5</li>
<li>number6</li>
</ul>
<script>
$('li').each(function(i,el) {
el = $(el);
alert(i);
alert(el.text());
});
</script>
</body>
</html>
为什么要用el = $(el);
直接用el.text()确实不行,我想知道原因
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1282/viewspace-3119622/ ,如需转载,请注明出处,否则将追究法律责任。