<div class="row"> <div class="col my-col my-col-blue" id="show1"> <h3>something</h3> <p>Lorem error ullam?</p> </div> <div class="col my-col my-col-red" id="show2> <h3>something</h3> <p>Lorem error ullam?</p> </div> <div class`enter code here`="col my-col my_nav" id="show3"> <h3>something</h3> <p>Lorem error ullam?</p> </div> </div> <div class="row" id="target1" style="display: none"> <div class="menu col my-col my-col-blue">fist 1</div> </div> <div class="row" id="target2" style="display: none"> <div class="col my-col my-col-red">fist 2</div> </div> <div class="row" id="target3" style="display: none"> <div class="col my-col my_nav">fist 3</div> </div>单击id(show1)以便切换(target1)时如何获得正确的ID。我能够按如下所示进行操作,但是我想创建一个可重用的函数。我可以按照自己的方式做,但是我需要3种不同的功能。谢谢ps。单击id(show1)时,id(target1)切换(显示)。$(document).ready(function() { $("#show1").click(function() { $("#target1").toggle(); }) })
添加回答
举报
0/150
提交
取消