JSFiddle - React, Tailwind, and code Playground
by bliako
HTML
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />
<title>ShuffleJS select dropdown example</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/w3-css/4.1.0/w3.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/Shuffle/6.1.0/shuffle.min.js" integrity="sha512-r8mIpk3ypCMwNxH6srRZGbjHQlOFt3Mq2vrZ/iymx6g9JUqTeVavofeX6gbrxAC74X5HmBy5gxyhCm6OiXrM0Q==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
</head>
<body style="background:#ffcccc;">
<div class="row h-100 justify-content-center align-items-center">
<form
id="searchform"
name="searchform"
class="myappsearch"
action=''
>
<div class="form-group col"> <!-- begin the A search text area -->
<legend><span>Select A <small>(onblur is handled with a timeout after onclick, works)</small>:</span></legend>
<textarea class="form-control form-control-sm filter__search js-shuffle-search"
id="search-textarea-A"
type="search"
rows="1"
required
onkeydown='handle_keydown_in_search_textarea(this, event);'
onblur='this.value = ""; mythis = this; setTimeout(function() { close_shuffle_dropdown(mythis); }, 200);'
onclick='A_clicked(this);'
></textarea>
<!-- this is a lame solution to the dropdown disappearing before the
onclick event on it is handled: Just act on the onblur after some
milliseconds so that the onclick has time to be handled first:
onblur='close_shuffle_dropdown(this);'
onblur='this.value = "";...