I am doing a search input
using the event keyup
in jquery, now if instead of input I use a select
what event would I use or how would I do in that case?
This is the input
<input type="text" name="pedido" class="form-control" id="pedido" required>
and this is the new select
<select name="pedido" id="busquedas" class="form-control" required>
<option> </option>
<option>FD1</option>
<option>FD2</option>
<option>FD3</option>
</select>
This is the jquery
$(obtener_registros());
function obtener_registros(pedido)
{
$.ajax({
url : 'ajax/ajax-consulta.php',
type : 'POST',
dataType : 'html',
data : { pedido: pedido },
})
.done(function(resultado){
$("#datos_cliente").html(resultado);
});
}
$(document).on('keyup', '#busquedas', function(){
var valorBusqueda=$(this).val();
if (valorBusqueda!="")
{
obtener_registros(valorBusqueda);
}
else
{
obtener_registros();
}
});