JSFiddle - React, Tailwind, and code Playground
by KyleMuir
HTML
<select id='sel' size='1'>
<option><></></option>
<option><p></p></option>
<option><div></p></option>
<option><a></a></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);
});
});