my html code:
<select class="b_selectbox">
<option value="0">Status</option>
</select>
<select class="b_selectbox">
<option value="0">Type</option>
</select>
<select class="b_selectbox">
<option value="0">Category</option>
</select>
That’s working for first element:
$(".b_selectbox option:first").text();
I am trying to get text “Type”, here is what i tried so far:
$(".b_selectbox option:first").text()[1]; // result: "t" probably second letter from "Status"
$(".b_selectbox option:first")[1].text(); // not working either
Is there a solution without using each and id names ?
Either
if each select element has only one option (makes a
selectunnecessary?), or if you want to get the second of all options, orif you want the text of the first
optionof the secondselectelement.For more information, see
.eq()[docs].