我有这个搜索框:
搜索框的代码是:
<form method = "post" action="search.php" class = "pull-down navbar-search">
<div class="input-append">
<input class="search-query input-medium" name="search_query" type="text" placeholder="Arama Yap" >
<button type = "submit "class="btn btn-large" type="button"><i class="icon-search"></i></button>
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
我希望搜索框在框和按钮之间没有空格.我怎么能完成它?谢谢.
我很难搞清楚如何做到这一点.
我正在使用google.map.places.Autocomplete并且它的工作正常,但由于应用程序/屏幕大小,带有返回搜索列表的pac容器位于设备虚拟键盘后面 - 因此我测试的设备大约有一半用户无法看到返回的地址列表.显然你不希望在键盘前放置pac容器,因为这样会隐藏各种键盘键.
如何强制pac容器出现在搜索/输入框的上方(并向上滚动)?
所以谷歌地图有一个基本的例子,带有搜索框:https://developers.google.com/maps/documentation/javascript/examples/places-searchbox
我想要完成一些非常简单的事情.我想硬编码一些位置(可能是一些简单的阵列/物体及其纬度和经度)然后当你搜索地点时,例如"华盛顿",那么这些位置会显示(带标记),如果有的话他们确实在华盛顿内部.如果我搜索"非洲"并且我的一些地点在非洲境内,我希望它们能够显示出来.如果我搜索一个没有我的位置的地方,那么它们应该只是不显示.
我也找到了这个 - https://developers.google.com/places/documentation/actions#adding_a_place.但我不确定这是否应该用于我的目的(或者我应该这样做).如果是,我不确定如何使用它 - 我在哪里发送建议的JSON数据?
提前致谢!
javascript google-maps search-box google-maps-api-3 google-maps-markers
我想将搜索框添加到单个选择下拉选项中.
码:
<select id="widget_for" name="{{widget_for}}">
<option value="">select</option>
{% for key, value in dr.items %}
<input placeholder="This ">
<option value="{% firstof value.id key %}" {% if key in selected_value %}selected{% endif %}>{% firstof value.name value %}</option>
{% endfor %}
</select>
Run Code Online (Sandbox Code Playgroud)
如上所述添加输入标签无法解决问题.
我尝试过使用html5-datalist,但它确实有效.我想要一些其他选项,因为html5-datalist不支持chrome中的可滚动选项.
有人可以推荐任何其他搜索框选项吗?它们应该与django-python框架兼容.
我正在尝试创建一个带有控件TextBox
和 的搜索框ListBox
。当我开始TextBox
输入事件处理程序时GotFocus
,打开ListBox
. 我希望在未聚焦ListBox
时将其关闭。我尝试在 中TextBox
使用该事件,但没有成功。LostFocus
TextBox
我应该在哪个事件处理程序中使用?我没有找到实现这种机制的好例子。
编辑:我有类似的东西:
<Canvas Name="m_MainCanvas" Grid.ColumnSpan="2" >
<Rectangle MouseDown="Canvas_MouseDown" Fill="White" Height="280" HorizontalAlignment="Left" Margin="256,12,0,0" x:Name="m_MainRectangle" RadiusX="0" RadiusY="0" Stroke="Black" StrokeThickness="3" VerticalAlignment="Top" Width="238" />
<TextBox Height="23" Margin="10,0,0,210" Name="m_SearchTextBox" VerticalAlignment="Bottom" BorderThickness="0.5" BorderBrush="#69000000" TextChanged="m_SearchTextBox_TextChanged" FontFamily="Kristen ITC" Text="" FontSize="14" FontWeight="Black" HorizontalAlignment="Left" Width="165" Canvas.Top="86" Canvas.Left="274" LostFocus="m_SearchTextBox_LostFocus"/>
<ListBox ItemTemplate="{DynamicResource ListBoxItemDataTemplate}" ItemsSource="{Binding}" Name="m_FriendsSearchList" Visibility="Hidden" Background="#FFBCEB85" Width="181" Height="193" Canvas.Left="283" Canvas.Top="118">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<EventSetter Event="MouseDoubleClick" Handler="HandleDoubleClickItemToSelect" />
</Style>
</ListBox.ItemContainerStyle>
</ListBox> …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用SearchBox
Windows 8.1中引入的控件,但我无法弄清楚如何在结果建议中显示图像.建议出现,但图像应该保留为空白:
这是我的XAML:
<SearchBox SuggestionsRequested="SearchBox_SuggestionsRequested" />
Run Code Online (Sandbox Code Playgroud)
我的代码背后:
private async void SearchBox_SuggestionsRequested(SearchBox sender, SearchBoxSuggestionsRequestedEventArgs args)
{
var deferral = args.Request.GetDeferral();
try
{
var imageUri = new Uri("ms-appx:///test.png");
var imageRef = await StorageFile.GetFileFromApplicationUriAsync(imageUri);
args.Request.SearchSuggestionCollection.AppendQuerySuggestion("test");
args.Request.SearchSuggestionCollection.AppendSearchSeparator("Foo Bar");
args.Request.SearchSuggestionCollection.AppendResultSuggestion("foo", "Details", "foo", imageRef, "Result");
args.Request.SearchSuggestionCollection.AppendResultSuggestion("bar", "Details", "bar", imageRef, "Result");
args.Request.SearchSuggestionCollection.AppendResultSuggestion("baz", "Details", "baz", imageRef, "Result");
}
finally
{
deferral.Complete();
}
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
一些额外的细节:
我尝试用XAML Spy调试它; 每个建议ListViewItem
都Content
设置为一个实例Windows.ApplicationModel.Search.Core.SearchSuggestion
.在这些SearchSuggestion
对象,我注意到Text
,Tag
,DetailText
,和ImageAlternateText
属性设置为自己的正确的值,但Image
属性为空... …
我希望用户在搜索框中键入时只看到国家/地区名称。是否可以?
我试过这个(不起作用):
var options = {
types: [('regions')]
};
var searchBox = new google.maps.places.SearchBox(input, options);
Run Code Online (Sandbox Code Playgroud) filtering autocomplete search-box google-maps-api-3 google-places-api
所以我使用 bootstrapp 制作了一个下拉菜单。
我在这里获取的代码:http ://getbootstrap.com/docs/4.0/components/dropdowns/
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown button
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
现在我想在下拉列表中添加一个搜索框,以便人们可以输入,它会缩短为更合适的下拉列表。
我尝试找到很多方法,其中一些使用像 Select2 这样的外部插件,但是,它们需要使用<select>
和<option>
标签编码的下拉菜单。相反,我的代码使用按钮和 Bootstrapp 的内置下拉类。
任何人请帮助我。
我使用以下代码添加了Google自定义搜索引擎.
(function() {
var cx = '005899633628958982661:wekn1lpckzg';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//cse.google.com/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
Run Code Online (Sandbox Code Playgroud)
现在我的网站有一个可用的搜索框,唯一的问题是我无法在搜索文本框中使用占位符.
我也尝试过代码
$('input.gsc-input').attr('placeholder', 'custom text here');
Run Code Online (Sandbox Code Playgroud)
但它不起作用.
search-box ×10
javascript ×4
autocomplete ×2
c# ×2
jquery ×2
bing ×1
bootstrap-4 ×1
controls ×1
css ×1
dropdownbox ×1
events ×1
filtering ×1
google-maps ×1
hidden ×1
html ×1
jira ×1
placeholder ×1
windows-8.1 ×1
wpf ×1
xaml ×1