steve5588065
Posts: 0
Joined: Tue Feb 26, 2013 6:36 am

determine if select menu empty

How can I tell if a select menu has been populated or not

It is populated from a rest service, but I need to know if it has been already populated or not

I have tried (from jquery site)
if (Tiggzi('smservice').has('option').length 0) {
alert('Options ' + Tiggzi('smservice').has('option').length);
}

This always returns 1 no matter how many are in the select or if non are in the select

any ideas please

Regards
steve

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

determine if select menu empty

It counts the select, not the options. For example, this works:

code
$('#j_4 option').length;
/code

where j_4 is the generated id.

steve5588065
Posts: 0
Joined: Tue Feb 26, 2013 6:36 am

determine if select menu empty

Hi Max

That doesn't work

It always shows 0 no matter how many are in the select menu

maxkatz
Posts: 0
Joined: Fri Aug 13, 2010 3:24 pm

determine if select menu empty

What id did you use for Select component? The example I gave above, your id might be different.

Return to “Issues”