Page 1 of 1

determine if select menu empty

Posted: Sun Mar 17, 2013 3:24 am
by steve5588065

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


determine if select menu empty

Posted: Sun Mar 17, 2013 4:51 am
by maxkatz

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

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

where j_4 is the generated id.


determine if select menu empty

Posted: Sun Mar 17, 2013 5:38 am
by steve5588065

Hi Max

That doesn't work

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


determine if select menu empty

Posted: Sun Mar 17, 2013 2:28 pm
by maxkatz

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