JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css">
<p>
<label for="distribuidor">Valores:</label>
<div class="ccmb"><input type="text" id="txtvalor" class="ccmbtxt" /><button id="btnvalor" type="button" class="ccmbbtn">▼</button></div>
<select id="valor" style="clear: both;">
<option value="default">default value</option>
<option value="valor1">Valor 1</option>
<option value="valor2">Valor 2</option>
<option value="valor3">Valor 3</option>
<option value="aaa">aaa</option>
<option value="gaz1">gaz 1</option>
<option value="zzz">zzz</option>
</select>
</p>
CSS
#frmhost {
margin-left: 5em;
}
label {
float: left;
display: block;
width: 10em;
}
#frmwebsrv {
margin-left: 5em;
}
#frmwebsrv fieldset {
width: 27em;
}
form {
width: 30em;
}
.bbutton {
float: right;
width: 7.5em;
height: 2.3em;
margin-top: 0.5em;
margin-right: 1.5em;
}
#content {
width: 500px;
margin-top: 1.5em;
margin-right: auto;
margin-left: auto;
}
.cmbbx {
margin: 0;
padding: 0;
height: 1.3em;
}
.cmbtxt{
width: 18em;
height: 100%;
margin: 0;
padding: 0 0.2em;
float: left;
/*-webkit-box-shadow: 1px 1px 5px 0px rgba(0, 0, 0, 0.8);
-moz-box-shadow: 1px 1px 5px 0px rgba(0, 0, 0, 0.8);
box-shadow: 1px 1px 5px 0px rgba(0, 0, 0, 0.8);*/
}
.cmbbtn{
width: 2.5em;
height: 100%;
margin: 0;
padding: 0;
float: left;
font-size: 0.5em;
top: 51%;
margin-top: -0.65em%;
-moz-border-radius-topleft: 0px;
-moz-border-radius-topright: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-bottomleft: 0px;
-webkit-border-radius: 0px 5px 5px 0px;
border-radius: 0px 5px 5px 0px;
border: 1px solid rgba(0, 0, 0, 0.6);
/*-webkit-box-shadow: 1px 1px 5px 0px rgba(0, 0, 0, 0.8);
-moz-box-shadow: 1px 1px 5px 0px rgba(0, 0, 0, 0.8);
box-shadow: 1px 1px 5px 0px rgba(0, 0, 0, 0.8);*/
}
.ccmb {
margin: 0 0 0 10em;
padding: 0;
border: 1px solid #999999;
height: 20px;
width: 16.25em;
}
.ccmbtxt {
width: 18em;
margin: 0;
/*border-left-color: black;
border-left-style: solid;
border-left-width: 1px;
border-top-color: black;
border-top-style: solid;
border-top-width: 1px;
border-bottom-color: black;
border-bottom-style: solid;
border-bottom-width: 1px;*/
border-style: none;
}
.ccmbbtn {
position: relative;
top: -2px;
font-size: 0.5em;
margin: 0;
padding: 0px;
...
JavaScript
var valores = [];
$("#valor option").each(function(i, value) {
if (i > 0) {
valores[i - 1] = $(value).text();
}
});
$("#txtvalor").autocomplete({
source: valores,
minLength: 0,
select: function(event, ui) {
var opcion = $("#valoroption").filter(function(index) {
return $(this).text() == ui.item.label;
}).val();
alert(opcion);
}
});
$("#btnvalor").click(function() {
$("#txtvalor").autocomplete("search", "");
$("#txtvalor").focus();
});
$("#txtvalor").click(function() {
$("#txtvalor").select();
$("#txtvalor").autocomplete("search", "");
$("#txtvalor").focus();
});
//$("#valor").hide();