 idx = selected.prop('selectedIndex');   toselect.prop('selectedIndex', idx); }  $('#countyselect').change(   function() {     matchUp($('#countyselect'), $('#siteselect'));   } );  $('#siteselect').change(   function() {     matchUp($('#siteselect'), $('#countyselect'));   } ); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/0.0.0/jquery.min.js"></script>  <select name="county" id="countyselect">  <option value="Dixie">Dixie</option>  <option value="Hernando">Hernando</option>  <option value="Holmes">Holmes</option>  <option value="Jackson">Jackson</option>  <option value="Liberty">Liberty</option>  <option value="Putnam">Putnam</option> </select> <select name="site" id="siteselect">  <option value="Florahome">Florahome</option>  <option value="Green Swamp">Green Swamp</option>  <option value="NE Jackson County">NE Jackson County</option>  <option value="N Holmes County">N Holmes County</option>  <option value="S Liberty County">S Liberty County</option>  <option value="Suwannee">Suwannee</option> </select>