JSFiddle - React, Tailwind, and code Playground

HTML

<select size="1" name="m" id="m">   
    <option selected value="1">apple</option>
    <option value="2">ball</option>
    <option value="3">cat</option>
    <option value="4">dog</option>
    <option value="5">egg</option>
</select>


<select size="1" name="a" id="a">  
    <option selected value="1">aaa</option>
    <option value="2">bbb</option>
    <option value="3">ccc</option>
</select>

JavaScript

var _selected = $('#m').val();
$('#m').change(function() {
    var answer = confirm("this will change your selection.");
    if (answer) { // ie, if i click 'OK'
        _selected = $(this).val();
        $('#a').val(_selected);
    } else {
        $(this).val(_selected);
    }
});