I'm selecting a select and trying to access one of the options to place it with the selected attribute, but whenever I try to use .att("selected", "selected");
I get the error: TypeError: size[0][1].attr is not a function
Select:
<select id="size" name="size" class="selectpicker" data-title="Tamanho" data-style="btn-default btn-block" data-menu-style="dropdown-blue">
<option value="PP" >PP</option>
<option value="P">P</option>
<option value="M">M</option>
<option value="G">G</option>
<option value="GG">GG</option>
<option value="XGG">XGG</option>
<option value="XXXG">XXXGG</option>
</select>
Jquery:
var size = $("#size");
size[0][1].attr('selected', 'selected');
Error:
TypeError: size[0][1].attr is not a function