How do I get the option box to return to the same former selected place after "cancel" selected in the alert?

Right now the code works, right now it goes to "disabled" option called "Common Languages" that has no functionality. That is not how it should work.

**What I want is to return to the former selected option after choosing "cancel" in alert.**

**JavaScript:**

```
<script type="text/javascript">
$(document).on('click', ':not(form)[data-confirm]', function(e){
    if(!confirm($(this).data('confirm'))){
        e.stopImmediatePropagation();
        e.preventDefault();
    }
});

$(document).on('submit', 'form[data-confirm]', function(e){
    if(!confirm($(this).data('confirm'))){
        e.stopImmediatePropagation();
        e.preventDefault();
    }
});

$(document).on('input', 'select', function(e){
    var msg = $(this).children('option:selected').data('confirm');
    if(msg != undefined && !confirm(msg)){
        $(this)[0].selectedIndex = 0;
    }
});
</script>

```

**HTML:**

```
<select name="LangF" id="opt">
<option value="" disabled>Common Languages:</option>
<option value="zh-CN">Chinese (Simplified)</option>
<option selected value="en">English</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="ru">Russian</option>
<option value="es">Spanish</option>
<option value="" disabled>&#8212;</option>
<option value="auto" data-confirm=" The ´´Automatic Language Detection´´ does not detect laguadges in frames / sandbox. Are you sure you want to select this option? ">Auto Detect</option>
<option value="" disabled>&#8212;</option>
<option value="" disabled>Other Languages:</option>
<option value="af">Afrikaans</option>
<option value="sq">Albanian</option>
<option value="ar">Arabic</option>
<option value="hy">Armenian</option>
<option value="az">Azerbaijani</option>
</select>

```

Right now it works, but the problem is that it goes to the 1 value of the option that is called "Common Languages:" value that is "disabled". I think there must be a way to make it go to another value like for example the automatic "selected" value called "English" from the option if not the former selected value.