JSFiddle - React, Tailwind, and code Playground

by samu_eyes

HTML

<script src="//cdn.jsdelivr.net/select2/3.4.0/select2.min.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/select2/3.4.0/select2.css">
<script src="//cdn.jsdelivr.net/select2/3.4.0/select2-spinner.gif"></script>
<script src="//cdn.jsdelivr.net/select2/3.4.0/select2.png"></script>
<select class=".select2">
    <option id="foo">Some Text</option>
    <option id="bar" selected="selected">Other Text</option>
</select>

JavaScript

//$('select').select2();

$('select').val('s'); // Select the option with a value of 'US'
$('select').trigger('change'); // Notify any JS components that the value changed