I have a Jquery show hide script that i have been using fine, i now want to add in a second div to show hide..
(我有一个我一直使用很好的Jquery show hide脚本,我现在想添加第二个div来显示hide。)
first div still shows and hides as it should however the second div hides but wont show..
(第一个div仍会显示和隐藏,但是第二个div会隐藏但不会显示。)
code:
(码:)
$(document).ready(function() { $('.slidingDiv').hide(); $('#show_hide').show(); $('.equipdetailupload').hide(); $('#show_hide2').show(); $('#show_hide').click(function() { $(".slidingDiv").slideToggle(); var isvisible = $(this).next('.slidingDiv').is(':visible'); if (isvisible) { $(this).next('.slidingDiv').hide(); } else { $(this).next('.slidingDiv').show(); } }); $('#show_hide2').click(function() { $(".equipdetailupload").slideToggle(); var isvisible = $(this).next('.equipdetailupload').is(':visible'); if (isvisible) { $(this).next('.equipdetailupload').hide(); } else { $(this).next('.equipdetailupload').show(); } }); });
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <a id='show_hide2' href='#'>upload Image</a> <p class='equipdetailupload'></p> <---------------------see notes <div class='equipdetailupload'> <!-- #INCLUDE virtual="imageup/uploadtester1.asp" --> </div>
Notes: The line marked with see notes i added as a test while trying to get the div to show, with that line in the div also shows without it the code doesnt work
(注意:标记为see的行是我在尝试使div显示时作为测试添加的,div中的该行也显示没有它的代码,该代码不起作用)
ask by Chris Rowley translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…