Make Last Option As Selected In Select,Drop Down,Combo Box

In this post we will see how we can make the selected property to the last option of a select or drop down or combo box. We will use a jquery selector for making the last option as selected.

Consider I have a following select element.

<select name="mySelect" id="mySelect" class="select">

Now by default we need that last option as selected right? To do that we can use the following script.

$("#mySelect option:last").attr("selected", "selected");

Here mySelect is the ID of our element.

Please see my other posts related to JQuery here: JQuery Posts

Kindest Regards
Sibeesh Venu