Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combo Box by default selected the last option

Tags:

People also ask

How do I select the last option in a dropdown?

To do that we can use the following script. $("#mySelect option:last"). attr("selected", "selected");

How do I set the default Select option?

The default value of the select element can be set by using the 'selected' attribute on the required option. This is a boolean attribute. The option that is having the 'selected' attribute will be displayed by default on the dropdown list.


I want a combobox by default selected the last option (using jquery):

<select>
    <option>item1</option>
    <option>item2</option>
    <option>item3</option>
    <option>item4</option>
    <option>item5</option>
</select>