繁体   English   中英

jQuery的下一个/上一个按钮不起作用

[英]jquery next/prev button not working

我创建了一个jquery问卷,当用户单击next和prev按钮时,它将导航到下一个问题。 单击此处,我注意到我的next和prev函数不在下一个问题旁边。

单击下一个按钮后,就不必再去问问题了,反之亦然。 以下是我的代码片段

if (parentContainer.next('.responsible-gaming__parentContainer').length) {
                parentContainer.hide();
                parentContainer.next('.responsible-gaming__parentContainer').show();
            }

有谁知道我该如何解决这个问题

看来您的选择器有误。

尝试这个:

http://jsfiddle.net/jFIT/y725p/7/

$('.nodetest__nextBtn').click(function () {
    $('.responsible-gaming__parentContainer:visible').hide().next('.responsible-gaming__parentContainer').show();
});
    $('.nodetest__prevBtn').click(function () {
    $('.responsible-gaming__parentContainer:visible').hide().prev('.responsible-gaming__parentContainer').show();
});

尝试使用jQuery的on()click函数

$( ".class" ).on( "click", function() { //do some stuff here; });

暂无
暂无

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

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