Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 344
Xorp25 Avatar asked Jun 17 '11 19:06

Xorp25


1 Answers

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

var count = $('div.rows').children().length;
like image 161
BoltClock Avatar answered Oct 30 '22 12:10

BoltClock