I have a select element.
<select class='cSelectType'> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> <option value="4">four</option> <option value="5">five</option> </select>
I can set the set jquery parameter as follows:
$('.cSelectType option[value=4]').attr('selected', 'selected');
And select the item that displays "Four." To my habit, something like this:
$('.cSelectType option[xxx=Four]').attr('selected', 'selected');
ie The selected attribute is selected in the text set.
some ideas please.
jquery html-select
loviji
source share