我有div里面的一堆城市。当你找不到你正在寻找的城市时,这是令人沮丧的。搜索一个div和缩小选项
因此,我试图添加一个搜索栏,以排除与搜索字符串不匹配的城市。
<form>
<div class="form-group">
<input type="text" class="form-control" id="exampleInputEmail1" placeholder="quick city search">
</div>
</form>
<div id="cities">
<div id="cities">
<a href="http://www.example.com/?city=alingsas" style="font-size: <?php echo mt_rand(5, 40); ?>px">Alingsås</a>
<a href="http://www.example.com/?city=borlange" style="font-size: <?php echo mt_rand(5, 40); ?>px">Borlänge</a>
<a href="http://www.example.com/?city=boras" style="font-size: <?php echo mt_rand(5, 40); ?>px">Borås</a>
<a href="http://www.example.com/?city=eskilstuna" style="font-size: <?php echo mt_rand(5, 40); ?>px">Eskilstuna</a>
<a href="http://www.example.com/?city=falun" style="font-size: <?php echo mt_rand(5, 40); ?>px">Falun</a>
<a href="http://www.example.com/?city=goteborg" style="font-size: <?php echo mt_rand(5, 40); ?>px">Göteborg</a>
<a href="http://www.example.com/?city=gavle" style="font-size: <?php echo mt_rand(5, 40); ?>px">Gävle</a>
<a href="http://www.example.com/?city=halmstad" style="font-size: <?php echo mt_rand(5, 40); ?>px">Halmstad</a>
<a href="http://www.example.com/?city=helsingborg" style="font-size: <?php echo mt_rand(5, 40); ?>px">Helsingborg</a>
<a href="http://www.example.com/?city=hudiksvall" style="font-size: <?php echo mt_rand(5, 40); ?>px">Hudiksvall</a>
<a href="http://www.example.com/?city=harnosand" style="font-size: <?php echo mt_rand(5, 40); ?>px">Härnösand</a>
<a href="http://www.example.com/?city=jonkoping" style="font-size: <?php echo mt_rand(5, 40); ?>px">Jönköping</a>
<a href="http://www.example.com/?city=kalmar" style="font-size: <?php echo mt_rand(5, 40); ?>px">Kalmar</a>
</div>
</div>
这是在Fiddle的尝试。
这与一个亮点是参考:http://jsfiddle.net/FranWahl/aSjqT/
我的问题是: 如何搜索一个div,并排除不是“搜索”字符串。
哪里是在这个问题上的问题吗? – void
我的意思是你想达到什么目的? – void