JSFiddle - React, Tailwind, and code Playground

by KyleMuir

HTML

<select id='sel' size='1'>
    <option>&#60;&#62;&#60;&#47;&#62;</option>
    <option>&#60;p&#62;&#60;&#47;p&#62;</option>
    <option>&#60;div&#62;&#60;&#47;p&#62;</option>
    <option>&#60;a&#62;&#60;&#47;a&#62;</option>
</select><br/><br/>
<textarea id='txtarea'></textarea>

CSS

textarea{width:100%;height:200px;}

JavaScript

(function($) {
    $.fn.selected = function(fn) {
        return this.each(function() {
            var clicknum = 0;
            $(this).click(function() {
                clicknum++;
                if (clicknum == 2) {
                    clicknum = 0;
                    fn(this);
                }
            });
        });
    }
})(jQuery);

$(document).ready(function() {
    var tempValue = '';
    $('select').selected(function() {
        tempValue += $('select').val();
        $('textarea').html(tempValue);        
    });
});