简体   繁体   English

用jQuery切换一个div

[英]Toggling a div with jquery

I would like for the div #share-sub-bottom to be toggled between shown and hidden when the user clicks the add photo link. 我希望当用户单击添加照片链接时,在显示和隐藏之间切换div #share-sub-bottom For some reason, I cannot get it to work, what could I be doing wrong? 由于某种原因,我无法使它正常工作,我可能做错了什么?

Jsfiddle Demo http://jsfiddle.net/Jzp5H/1/ Jsfiddle演示http://jsfiddle.net/Jzp5H/1/

Check out this jsfiddle . 看看这个jsfiddle You gave to Add photo link the class class=".show_hide" and this is not correct. 您给“ Add photo链接Add photo了类class=".show_hide" ,这是不正确的。 You should gave it show_hide 你应该给它show_hide

remove the dot from your class definition, and it works like charm 从您的类定义中删除点,它就像魅力

this you have 这个你有

<p> <a href="#" class=".show_hide"> Add Photo </a> </p>

this you should have 这个你应该有

<p> <a href="#" class="show_hide"> Add Photo </a> </p>

Hi now demo http://jsfiddle.net/Jzp5H/8/ 嗨,现在演示http://jsfiddle.net/Jzp5H/8/

<a href="#" class=".show_hide"> Add Photo </a>

into this 进入这个

<a href="#" class="show_hide"> Add Photo </a>

Do not use a dot in front class=".show_hide" used simply class="show_hide" 请勿在前面的 class=".show_hide"仅使用class="show_hide"

Change in your html file for this line: 在您的html文件中更改以下内容:

<a href="#" class=".show_hide"> Add Photo </a>

To this: 对此:

<a href="#" class="show_hide"> Add Photo </a>

Don't use dot(.) in front. 不要在前面使用dot(。)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM