4
I have a <select>
created in 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 val("1")
pass text. For example:
$("#animal").val("Bezerro");
In this case being selected the option "Calf". How to select an option in <select>
through a text using jQuery ?
@Lucascosta is just an example.
– viana