Link to home
Start Free TrialLog in
Avatar of Camillia
CamilliaFlag for United States of America

asked on

jQuery - how can I set focus to first valid element in dropdown?

I used this to set focus to first element in a dropdown

$("#newSplitTrader").val($("#newSplitTrader option:first").val());

Open in new window


But I want to change it to set focus to first element that doesn't have display:none?

The ddl looks like this. See the first element has "display:none". I want to set it to second one, in this case. So, first one that doesn't have "display:none". It should be Jane, III in this case

<select class="k-header k-dropdown ddl-enum" id="newSplitTrader" name="newSplitTrader" tabindex="0">
<option value="1" style="display: none;">Bob Jaco</option>
<option value="2">Jane, III</option>
<option value="3" style="display: none;">Joe xxx</option>
<option value="4">Rod Jxxx</option>
<option value="5">Bria xxx</option>
<option value="6">Jeff  xxx</option>
<option value="13">Inactive</option>
<option value="14" style="display: block;">RAF</option>
<option value="15">GS</option>
</select>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Camillia

ASKER

Thanks, let me see