jquery对div显示和隐藏
<div id="divObj" style="display:none"> 1.测试例子<br/> 2.测试例子<br/> </div> <input type="button" value="隐藏" onclick="hiden()"/> <input type="button" value="显示" onclick="show()"/> <script type="text/javascript"> function hiden() { $("#divObj").hide(); } function show() { $("#divObj").show(); } </script>
1:需要引入jquery
2:若input换为a标签,可以这样
<a href="javascript:void(0);" onclick="show()" >展开</a>
<a href="javascript:void(0);" onclick="hide()" >收起</a>
相关推荐
zhanghao 2020-03-23
ThinkingLink 2020-01-12
89463661 2019-12-27
maoye 2014-05-29
qianwenjie 2015-10-28
moxiaoxi 2016-01-08
asdjkl 2016-12-22
花花的技术 2017-06-02
aeoliancrazy 2018-11-13
t0ckh 2013-06-04
何双江yarshray 2017-06-02
小源丶同学 2016-12-22
愚盦 2016-10-30
Jiutocrx 2016-10-06
王甲评 2016-02-17
zhangyusng 2015-11-27
hyv 2015-10-28