I'm trying to allow users to click on the [+]
trigger and have it's sibling div open and close to display that topic's information.
Why can't this find the sibling?
$('.moreInfo').hide();
$('a.triggerButton').click(function(){
var $this = $('a.triggerButton');
$this.find().siblings('.moreInfo').slideToggle('fast');
});
I made a fiddle here . Thanks for your help.
Because firstly you should address this
anchor element, and secondly get rid of useless .find()
:
$("a.triggerButton").click(function() {
$(this).siblings(".moreInfo").slideToggle("fast");
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.