用jQuery盲 [英] Blind with jQuery
本文介绍了用jQuery盲的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试编写一个盲函数,该函数将在display:none模式下关闭DIV. 看不见的DIV位于更宽的DIV中,其中包含盲触发器.
I'm trying to write a blind function that would close a DIV in a display:none mode. The unseen DIV is inside a wider DIV, containing the blind trigger.
此:
$(document).ready(function () {
$("#toggle_blind").click(function () {
$(this).toggle("fast");
});
});
好吧,这会遮住按钮.如何将DIV添加到$ this?像这样:
Well, this blinds the button. How can I add a DIV to $this? Something like:
<div id="blind" class="wider_div">
<h3 id="closeButton">Close</h3>
<div style="display:none;" id="closeThis">
<p>some text</p>
</div>
</div>
如何使H3上的关闭按钮在每次单击时关闭/打开CloseButton DIV?
How do I make the Close Button on H3 to close/open the CloseButton DIV on each click?
谢谢!
推荐答案
div是h3的下一个兄弟,因此您可以使用.next()
The div is the next sibling of the h3 so you can use .next()
例如
$('#closeButton').click( function(){
$(this).next().toggle();
});
这篇关于用jQuery盲的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文