我有一些按钮,我希望当用户按下它们时显示一些文本并隐藏上一个按钮的文本。看起来很简单,但我的代码不起作用(你可以在这里看到它 -> CODE)
//These are the buttons
<div class="row-fluid">
<div class=" span1 offset0" target="1"> <a href="#" class="circle lnkCollapse">TITLE1</a></div>
<div class="span1 offset4" target="2"> <a href="#" class="circle lnkCollapse">TITLE2</a></div>
</div>
<div class="box">
<div class="contentArea">
<div class="box-title">TITLE:</div>
//this is the text for the 1st button
<div id="div1">
<div class="box-text">
Lorem ipsum dolor sit amet
</div>
<div class="box-links">
<a href="#">GO</a>
<a href="#">TEST</a>
</div>
</div>
//this is the text for the 2nd button
<div id="div2">
<div class="box-text">
Lorem ipsum dolor sit amet
</div>
<div class="box-links">
<a href="#">GO</a>
<a href="#">TEST</a>
</div>
</div>
</div>
在标题中我放了这个:
$(document).ready(function() {
$('.lnkCollapse').click(function () {
$('.contentArea').hide();
$('#div' + $(this).attr('target')).show();
});
});
什么都没有发生..非常感谢!