Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>JS Bin</title>
  </head>
  <body>
    <form>
        <label>City:</label>
        <select>
            <option>London</option>
            <option>Paris</option>
            <option>New York</option>
        </select>
    </form>
    
  <p><strong>Note:</strong> Select any value from the dropdown select and see the result.</p>
    
    <script src="https://code.jquery.com/jquery-2.0.3.js"></script>
  </body>
</html>
 
$(() => {
  // listen for a .change() event on the <select> element
 $('select').change((event) => {
   const selectedOption = $(event.currentTarget).find(':selected').val()
   
   alert(`You have selected ${selectedOption}`)
  }) 
})
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x