JSFiddle - React, Tailwind, and code Playground

by karin

HTML

<select id="weatherSelect">
     <option value="0">select</option>
    <option value="1">one</option>
    <option value="2">two</option>
</select>
<input type="text" id="weatherValue" value="sel"/>

JavaScript

$('#weatherSelect').click(function() {
                  var rateWeather = $(this).val();
                     $('#weatherValue').val(rateWeather);
                    if($('#weatherValue').val()=='2'){
                         alert(rateWeather);
                        $('#weatherValue').val('');
                        $('#weatherValue').val('');
                    }
                });