With the following javascript
I'm trying to submit a result once it is selected, but nothing happens! Any ideas why this is happening?
<input name="search" id="search" class="search-query search_size" placeholder="Enter keyword to search" data-autocomplete-label="Sorry, nothing found." data-autocomplete="/items/autocomplete_item_title" type="search">
<script>
$('#search').bind('railsAutocomplete.select', function(event, data){
$('#search').submit();
alert(data.item.id);
});
</script>
Update 1
This is the rails form I'm trying to submit:
<%= form_tag items_path, :method => "get", id: "search" do %>
<%= text_field_tag :search, params[:search], class: "search-query search_size",
placeholder: "Enter keyword to search", type: "search",
:"data-autocomplete-label" => "Sorry, nothing found.",
data: {autocomplete: autocomplete_item_title_items_path } %>
<%= submit_tag "Search", name: nil, :style => "display: none;" %>
<%end%>