在html和jquery中使用Li更改Div [英] Change Div using Li in html and jquery
本文介绍了在html和jquery中使用Li更改Div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有几个div(可能是4或5),< ul>< li>
I have few div (may be 4 or 5) , and <ul><li>
<ul><li><a href="#GetCol">Color</a></li></ul>
<ul><li><a href="#GetBrd">Brand</a></li></ul>
<ul><li><a href="#GetMast">Master</a></li></ul>
<ul><li><a href="#GetCars">Cards</a></li></ul>
<div id="MainAl" class=".allclass">
<div id="GetCol">
Color - Red
</div>
<div id="GetMast">
Master - MySelf
</div>
</div>
我想显示div GetCol
并隐藏其他全部,当 Color(GetCol)
点击列表。
GetBrd
等等...
我希望你明白
请咨询
问候
I want to show div GetCol
and hide other all , when Color(GetCol)
list clicked.
same way for GetBrd
.. etc....
I hope u understood
Pls advice
regards
推荐答案
试试这个:
Try this:
(' ul li a')。click(function(){
var href =
('ul li a').click(function() { var href =
( this )。attr(' href');
(this).attr('href');
这篇关于在html和jquery中使用Li更改Div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文