Javascript 如何在html页面的其他容器上显示div?

Javascript 如何在html页面的其他容器上显示div?,javascript,jquery,css,html,Javascript,Jquery,Css,Html,我不熟悉html和css,我创建了一个包含citynames的div。 我试图在点击按钮时显示那个div,但当我点击按钮时,那个div就会隐藏在我页面的下一部分后面。 这是它看起来像的图像: 但我想在该div下面的部分显示该div,而不是后面。要了解更多信息,请查看并单击“印度其他地区”下拉按钮。 以下是我的html代码: <!--start SearchBox section--> <section id="searchbox"style="backgrou

我不熟悉html和css,我创建了一个包含citynames的div。 我试图在点击按钮时显示那个div,但当我点击按钮时,那个div就会隐藏在我页面的下一部分后面。 这是它看起来像的图像:

但我想在该div下面的部分显示该div,而不是后面。要了解更多信息,请查看并单击“印度其他地区”下拉按钮。 以下是我的html代码:

<!--start SearchBox section-->
        <section id="searchbox"style="background:white">
            <div class="container" style="margin-top:0px;">


              <div class="row">

                    <div class="col-lg-12">


               <form style="">
                    <center>
                            <div id="SearchBoxBorder" style="background:white;border-style:soli;border-radius:5px;margin-top:20px;width:800px;">
                            <table id="mytable" >
                                    <td style="width:300px;background:white;">
                                       <center> <div class="form-group">
                                                <input type="text" class="form-control" id="exampleInputEmail1" placeholder="I am looking for"
                                                    style="border-width:5px;background:white; margin-top:17px; margin-left:15px; margin-right:10px;width:300px;
                                                    border-style:solid;border-width:5px;border-color:#eee;font-family:Arial,Helvetica,sans-serif;height:42px; font-size:18px;">
                                        </div></center>
                                     </td>

                                     <td style="width:50px ;text-align:right;background:white;"> <center><strong> in</strong></center>    </td>

                                     <td style="width:400px;background:white;">
                                     <center>
                                             <div class="input-group" style="position: relative;">
                                                   <input type="text" class="form-control" placeholder="in locality"
                                                    style="border-width:5px;background:white; margin-top:2px; margin-left:10px; margin-right:20px;width:;font-size:18px;
                                                    border-style:solid;border-width:5px;border-color:#eee;font-family:Arial,Helvetica,sans-serif;height:42px;">
                                                   <div class="input-group-btn" >
                                                            <button type="button" class="btn btn-default dropdown-toggle"  data-toggle="dropdown" id="dropdownBtn" 
                                                             style="background:white;border-top-width:5px;border-right-width:5px;border-bottom-width:5px;border-left-width:1px;
                                                             border-color:#eee;height:42px;border-radius:0px;text-align:center;color:black; margin-right:20px;margin-top:2px;">Select<span class="caret"></span></button>

                                                             <!--City dropdown -->
                                                                    <div class="SearchCities" id="dialog" title="Basic dialog" >

                                                                            <div id="outer" style="">



                                                                                        <div id="innerLeft" style="">
                                                                                            <h5 >North India:</h5>
                                                                                            <ul class="city" type="none";>
                                                                                                    <li><a>Delhi</a></li>
                                                                                                    <li><a>Agra</a></li>
                                                                                                    <li><a>Shrinagar</a></li>
                                                                                                    <li><a>Noida</a></li>
                                                                                                    <li><a>Himachal</a></li>
                                                                                                    <li><a>Patna</a></li>
                                                                                            </ul>

                                                                                        </div>

                                                                                        <div id="innerRight" style="">
                                                                                            <a class="close">&times;</a>
                                                                                            <h5>West India:</h5>
                                                                                            <ul class="city" type="none";>
                                                                                                    <li><a>Mumbai</a></li>
                                                                                                    <li><a>Pune</a></li>
                                                                                                    <li><a>Nashik</a></li>
                                                                                                    <li><a>Kolhapur</a></li>
                                                                                                    <li><a>Osmanabad</a></li>
                                                                                                    <li><a>Ahamdabad</a></li>
                                                                                            </ul>
                                                                                        </div>


                                                                            </div><!--/outer-->
                                                                        </div><!--/SearchCities-->


                                                             </div><!-- /btn-group -->
                                                   <button type="button" class="btn btn-primary" style="margin-right:20px;"><i class="icon-search" style="font-size:20px"></i>  Search</button>
                                             </div><!-- /input-group -->
                                           </center>         
                                     </td>

                            </table>
                        </center>
                    </form>

    </div><!--/col-lg-12-->
</div><!--/row-->
    </div><!--/end of container-->
</section>
<!--End of SearchBox section-->
因此,请帮助我,并提出任何解决方案,以实现上述。 谢谢你的建议

我添加了
.searchCiries{z-index:1;}
,以下是我的输出:

我不希望城市名称出现在container div中。因此,请建议您进行任何更正

    z-index: 9990;
在你们部门的课上。此CSS选项将使div位于最前面(除非其他元素的z-index值大于9990,否则最大值为9999)

你应该把

    z-index: 9990;
在你们部门的课上。此CSS选项将使div位于最前面(除非其他元素的z-index值大于9990,否则最大值为9999)


在css中添加一个
z-index
值,比如说:
z-index:100
在css中添加一个
z-index
值,比如说:
z-index:100

,搜索城市,给出z-index:10;如果它不起作用,继续将值从10增加到更多也许你想要的是将div插入到页面流中,而不是与其他内容重叠?另外,为什么要使用
float:right
position:absolute
position:absolute
将对象从页面流中移除,因此
float:right
不起任何作用;如果它不起作用,继续将值从10增加到更多也许你想要的是将div插入到页面流中,而不是与其他内容重叠?另外,为什么要使用
float:right
position:absolute
position:absolute
将对象从页面流中移除,因此
float:right
不起任何作用。是的@Aneesh我在css中添加了z-index:1,它显示div高于其他元素,但该div的内部内容也显示在该div的上方。请参见我在问题中添加的最后一幅图像。是的@Aneesh我在css中添加了z-index:1,它显示该div高于其他元素,但该div的内部内容也显示在该div的上方。请参阅我在问题中添加的最后一幅图像。该页面确切地说在哪里有最大值?顺便说一下,这不是一个很好的学习z索引的页面。它使用了令人困惑的术语,混淆了z索引和堆叠顺序等。该页面确切地说在哪里有最大值?顺便说一下,这不是一个很好的学习z索引的页面。它使用了令人困惑的术语,混淆了z索引和堆叠顺序等。