终极WP查询搜索过滤器 - 使用' next'切换单选按钮。 &安培; '分组'箭头

时间:2016-07-29 12:19:31

标签: javascript ajax wordpress

我使用Wordpress插件,终极WP查询搜索过滤器,用AJAX显示我的帖子,可以通过不同的类别过滤帖子。

目前,我只能将搜索栏显示为单选按钮,复选框或下拉菜单。

我想要实现的是能够拥有可以切换单选按钮的下一个和上一个箭头。

我已经得到它所以检查箭头上的输入字段但是帖子没有改变?谁能指出我正确的方向?

http://bluemoontesting.co.uk/carltonsmith/

$(document).ready(function(){
    $('.prev').click(function(){
        $(this).parent().find('input:checked').parent().prev().children('input').prop("checked", true);
    });

    $('.next').click(function(){
        $(this).parent().find('input:checked').parent().next().children('input').prop("checked", true);
    });
});

1 个答案:

答案 0 :(得分:0)

答案是:只需在末尾添加.change(),因为这会触发前面定义的单选按钮的onchange事件。

$(this).parent().find('input:checked').parent().prev().children('input').prop("checked", true).change();