最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - $("div.rows").children().length is not a function - Stack Overflow

programmeradmin10浏览0评论

I´m testing the length property which returns this error:

$("div.rows").children().length is not a function

var count = $('div.rows').children().length();
$('div#header').html(count);

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?

I´m testing the length property which returns this error:

$("div.rows").children().length is not a function

var count = $('div.rows').children().length();
$('div#header').html(count);

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?

Share Improve this question asked Jun 17, 2011 at 19:46 Xorp25Xorp25 631 silver badge3 bronze badges 1
  • api.jquery.com/length – Felix Kling Commented Jun 17, 2011 at 19:50
Add a comment  | 

1 Answer 1

Reset to default 17

It's not a function, it's a numeric property, so lose the last () pair:

var count = $('div.rows').children().length;
发布评论

评论列表(0)

  1. 暂无评论