导航栏搜索支持enter键
This commit is contained in:
parent
7263598851
commit
e5bf355a17
|
@ -19,7 +19,7 @@
|
|||
</div>
|
||||
<script>
|
||||
<% type = type%>
|
||||
$(document).ready(function (){
|
||||
$(function (){
|
||||
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
|
||||
$('input:radio[value="courses"]').attr('checked','checked');
|
||||
}
|
||||
|
@ -30,13 +30,22 @@
|
|||
$('input:radio[value="users"]').attr('checked','checked');
|
||||
}
|
||||
});
|
||||
|
||||
$(function(){
|
||||
$("#navHomepageSearchInput").keypress(function(e){
|
||||
if (e.keyCode == '13') {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
$(this).parent().submit();
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<div class="fl" id="navHomepageSearch">
|
||||
<!--<form class="navHomepageSearchBox">-->
|
||||
<% name = name%>
|
||||
|
||||
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" />
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索"/>
|
||||
<input type="hidden" name="search_type" id="type" value=""/>
|
||||
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="$('#type').val($('input[type=radio]:checked').val());$(this).parent().submit();"></a>
|
||||
<% end %>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
$(doc).parent().submit();
|
||||
}
|
||||
<% type = type%>
|
||||
$(document).ready(function (){
|
||||
$(function (){
|
||||
if('<%= type %>' != null && '<%= type %>' == 'courses' ){
|
||||
$('input:radio[value="courses"]').attr('checked','checked');
|
||||
}
|
||||
|
@ -30,13 +30,22 @@
|
|||
$('input:radio[value="users"]').attr('checked','checked');
|
||||
}
|
||||
});
|
||||
|
||||
$(function(){
|
||||
$("#navHomepageSearchInput").keypress(function(e){
|
||||
if (e.keyCode == '13') {
|
||||
$('#type').val($('input[type=radio]:checked').val());
|
||||
$(this).parent().submit();
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
<div class="fl" id="navHomepageSearch">
|
||||
<!--<form class="navHomepageSearchBox">-->
|
||||
<% name = name%>
|
||||
|
||||
<%= form_tag({controller: :welcome, action: :search },:class=>'navHomepageSearchBox', method: :get) do %>
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" />
|
||||
<input type="text" name="q" value="<%= name.nil? ? "" : name%>" id="navHomepageSearchInput" class="navHomepageSearchInput" placeholder="请输入关键词进行搜索" />
|
||||
<input type="hidden" name="search_type" id="type" value=""/>
|
||||
<a href="javascript:void(0);" class="homepageSearchIcon" onclick="$('#type').val($('input[type=radio]:checked').val());$(this).parent().submit();"></a>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in New Issue