Reputation: 21927
I am using this as a way to filter a select box. I want to extend it so that if there is only one option left it is automatically selected. Can anyone help me with this?
Upvotes: 2
Views: 3114
Reputation: 28160
if ($j('#selectList option:visible').length == 1) {
$j('#selectList option:visible').attr('selected', true);
}
Upvotes: 4