Reputation: 21
I have several selects on a page with the same class VirtueClass
. Now I want to change the selected item on the first select on the page where the value equals 0
, e.g. the first "free" select on the page.
How can I write such a selector?
Upvotes: 2
Views: 85
Reputation: 146310
$('.VirtueClass').filter(function(){
return this.value == 0;
}).eq(0);
This will select the first item that is set to zero
Upvotes: 1