每当我编写以下内容时,我都无法编写每个函数类,为什么会出现错误?
<script>
var addLi = function($li) {
var $uls = $('ul');
$.each($uls, function(index, ul) {
// If this ul has less than 5 li's
// then add the li here
if ($(this).find('li').length < 5) {
$(this).append($li);
// exit the for loop since we have placed this li
return;
}
}
};
</script>