JSFiddle - React, Tailwind, and code Playground

by st3fan

HTML

<select>
    <option value="0">Select value</option>
</select>

JavaScript

$('select').on('focus', function() {
    
    var $this = $(this);
        
    // run your alert here if it´s necessary
    alert('Focused for the first time :)');
    
    // add the new option elements
    $this.append('<option value="1">1</option><option value="2">2</option>');
    
    // unbind the event to prevent it from being triggered again
    $this.unbind('focus');
});