JSFiddle - React, Tailwind, and code Playground
by Omar X
HTML
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
<div data-role="content" id="hello"></div>
JavaScript
$('#hello').append('<select id="myselect" data-native-menu="false">' +
' <option>1</option>' +
'<option>2</option>' +
'<option>3</option>' +
'<option>4</option>' +
'<option>5</option>' +
'<option>6</option>' +
'</select>' +
'<div id="keyOpen" style="background-color: blue;"></div>' +
'<div id="keyClose"></div>');
$("#myselect").selectmenu();
$(document).keyup(function (e) {
if (e.which >= 48 && e.which <= 57) {
$("#myselect").selectmenu("open"); //this should open the select
$("#keyOpen").empty().text(e.which);
} else if (e.which >= 58 && e.which <= 90) {
$("#myselect").selectmenu("close"); //this should close the select
$("#keyClose").empty().text(e.which);
}
});