I have <select>
created this way:
<select id="animal">
<option value="0">Novilha</option>
<option value="1">Bezerro</option>
<option value="2">Boi</option>
</select>
To change the checkbox programmatically using jQuery I use the following command:
$("#animal").val("1"); /* faz com que o Bezerro fique selecionado */
But I would like to know what it would be like to pass as a parameter instead of the val("1")
pass the text. For example:
$("#animal").val("Bezerro");
In this case the option "Calf" is selected. How to select an option in <select>
through text using jQuery?