Run Submit after auto complete field

Asked

Viewed 62 times

0

How can I do in this code below that soon after performing the auto complete in the field, and when choosing the record it immediately realize the form Submit

Example of code working below

window.onload=function(){

$(document).ready(function() {
$('input.typeahead-devs').typeahead({
  name: 'accounts',
  local: ['Sunday', 'Monday', 'Tuesday','Wednesday','Thursday','Friday','Saturday']
});
})


}//]]> 
    .typeahead-devs, .tt-hint {
 	border: 2px solid #CCCCCC;
    border-radius: 8px 8px 8px 8px;
    font-size: 24px;
    height: 45px;
    line-height: 30px;
    outline: medium none;
    padding: 8px 12px;
    width: 400px;
}

.tt-dropdown-menu {
  width: 400px;
  margin-top: 5px;
  padding: 8px 12px;
  background-color: #fff;
  border: 1px solid #ccc;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 8px 8px 8px 8px;
  font-size: 18px;
  color: #111;
  background-color: #F1F1F1;
}
<link rel="stylesheet" type="text/css" href="http://transfer-online.net/gerenciador/files/includes/auto_compl/css/bootstrap.css">
      <script type="text/javascript" src="http://transfer-online.net/gerenciador/files/includes/auto_compl/js/jquery.js"></script>
      <script type="text/javascript" src="http://transfer-online.net/gerenciador/files/includes/auto_compl/js/bootstrap.js"></script>
      <script type="text/javascript" src="http://transfer-online.net/gerenciador/files/includes/auto_compl/js/typeahead.js"></script>
    


   <input type="text" name="accounts" size="20" class="typeahead-devs" placeholder="Please Enter Day Name">

1 answer

0

An alternative would be to call the submit() form when the field loses focus through the event onfocusout

<input type="text" name="accounts" onfocusout="form.submit();" size="20" class="typeahead-devs" placeholder="Please Enter Day Name">

Browser other questions tagged

You are not signed in. Login or sign up in order to post.