gpt4 book ai didi

javascript - 在 Bootstrap header 内的搜索栏旁边添加按钮

转载 作者:行者123 更新时间:2023-11-28 06:09:12 24 4
gpt4 key购买 nike

我创建了一个响应式 Bootstrap header ,其左上角有名称,右上角有搜索栏和下拉列表。现在我想在搜索栏的左侧添加一个按钮,但无法..

Js fiddle https://jsfiddle.net/Lucy1/qn0r10th/4/

HTML代码..

     <nav class="navbar navbar-default navbar-fixed-top" id="header">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar1">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a href="index.html" class="navbar-brand" id="icon"><b>Sample Name</b></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar1">

<ul class="nav navbar-nav navbar-right" id="navbar1right">
<li class="dropdown" id="subheader">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
<ul class="dropdown-menu" id="dropA">
<li><a href="#">Action</a></li>
</ul>
</li>
</ul>

<form class="navbar-form navbar-right" role="search" id="navBarSearchForm" type=get action="myindex.html">
<div class="input-group" id ="searchA">
<button onclick="storeYourStuff()" id="button_top_right" class="btn btn-primary">StoreYourStuff</button>
<input id="wish_title1" type="text" class="form-control" placeholder="Search Website" name="wish_title1"></input>
<span class="input-group-btn">
<button class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button>
</span>
</div>

</form>
</div>
</div>
</nav>

我试图在表单标签内的搜索栏之前添加一个按钮,但无法添加。不知道我哪里出错了..请帮忙

最佳答案

按钮应该放在合适的范围内

<form class="navbar-form navbar-right" role="search" id="navBarSearchForm" type=get action="myindex.html">
<div class="input-group" id ="searchA">
<span class="input-group-btn"><button onclick="storeYourStuff()" id="button_top_right" class="btn btn-primary">StoreYourStuff</button></span>

<input id="wish_title1" type="text" class="form-control" placeholder="Search Website" name="wish_title1">
<span class="input-group-btn">
<button class="btn btn-primary"><i class="glyphicon glyphicon-search"></i></button>
</span>
</div>
</form>

关于javascript - 在 Bootstrap header 内的搜索栏旁边添加按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36268567/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com