views:

600

answers:

4
$("#experiences tr")

For the above one,how to judge if it's empty or not?

I thought its boolean value should be false,but seems not.

+11  A: 

use the length property:

$("#experiences tr").length

if it's 0 it's empty

mck89
A: 

Or, if you just want to affect only the empty elements, use

$('#experiences tr:empty')

or the other way around:

$('#experiences tr:not(:empty)')
JorenB
A: 
var experienceRows = $('#experiences tr'),
    len = experienceRows.length;

if ( len ) {
} else {
}
meder
A: 
$("#experiences tr:empty")
Jason