CSS 的 typeahead 无法使用 turbolinks
CSS of typeahead not working with turbolinks on
问题与在页面上按任意 link 后文本输入框的移动有关。
Turbolinks 已开启。[如果删除这行代码,问题就会得到解决]
//= require jquery.turbolinks
Javascript与搜索框关联正常:
var ready;
ready = function() {
$('.typeahead').typeahead(null, {
...
});
}
$(document).ready(ready);
$(document).on('page:load', ready);
同样在 重新加载 时 "Before" 状态被恢复。
问题特别发生在带有 typeahead 标记的输入框上。
之前:
之后:
搜索文本字段最初嵌入了以下 Ruby:
<%= text_field_tag :search, params[:search],class: "address form-control" %>
将其更改为
<%= text_field_tag :search, params[:search],id: "address",class: "form-control" %>
解决了问题。
问题与在页面上按任意 link 后文本输入框的移动有关。
Turbolinks 已开启。[如果删除这行代码,问题就会得到解决]
//= require jquery.turbolinks
Javascript与搜索框关联正常:
var ready;
ready = function() {
$('.typeahead').typeahead(null, {
...
});
}
$(document).ready(ready);
$(document).on('page:load', ready);
同样在 重新加载 时 "Before" 状态被恢复。
问题特别发生在带有 typeahead 标记的输入框上。
之前:
之后:
搜索文本字段最初嵌入了以下 Ruby:
<%= text_field_tag :search, params[:search],class: "address form-control" %>
将其更改为
<%= text_field_tag :search, params[:search],id: "address",class: "form-control" %>
解决了问题。