$(& quot; div.rows& quot;).children().length不是函数 [英] $("div.rows").children().length is not a function
本文介绍了$(& quot; div.rows& quot;).children().length不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在测试会返回此错误的length属性:
I´m testing the length property which returns this error:
$("div.rows").children().length不是 一个功能
$("div.rows").children().length is not a function
var count = $('div.rows').children().length();
$('div#header').html(count);
当我使用.size();时它确实向我显示了一个值为0的值,该值仍然是错误的,但至少不会返回错误.
When i use .size(); it does show me a value, which is 0, which is still wrong but at least it doesn't return an error.
我正在把头发拔过去.有什么想法吗?
I'm pulling my hair out over this one. Any ideas?
推荐答案
这不是函数,而是数字属性,因此请丢失最后一个()
对:
It's not a function, it's a numeric property, so lose the last ()
pair:
var count = $('div.rows').children().length;
这篇关于$(& quot; div.rows& quot;).children().length不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文