Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我可以让两个更改事件侦听器相互激发吗?_Javascript_Html_Jquery_Onchange - Fatal编程技术网

Javascript 我可以让两个更改事件侦听器相互激发吗?

Javascript 我可以让两个更改事件侦听器相互激发吗?,javascript,html,jquery,onchange,Javascript,Html,Jquery,Onchange,是否可以让一个变更同时触发另一个变更事件,反之亦然,以便它们协同工作 /*过滤函数语言*/ $'input[type=radio][name=languagefilter]'{ $language=this.value; $.standardtaskcheckboxwrapper.hide; $.standardtaskcheckboxwrapper.+$language.show; }; /*过滤函数类别类型*/ $'input[type=radio][name=associateddomai

是否可以让一个变更同时触发另一个变更事件,反之亦然,以便它们协同工作

/*过滤函数语言*/ $'input[type=radio][name=languagefilter]'{ $language=this.value; $.standardtaskcheckboxwrapper.hide; $.standardtaskcheckboxwrapper.+$language.show; }; /*过滤函数类别类型*/ $'input[type=radio][name=associateddomain]'。changefunction{ $dataCatType=$this.attr'data-cat-type'; log$datacatype; $.standardtaskcheckboxwrapper.hide; $.standardtaskcheckboxwrapper.+$dataCatType.show; $.standardtaskcheckboxwrapper.+'all'。显示; }; 用于此的HTML如下所示:

$('input[type=radio][name=languagefilter], input[type=radio][name=associateddomain]').change(function() {

  $language = this.value;
  $(".standardtaskcheckboxwrapper").hide();
  $(".standardtaskcheckboxwrapper." + $language).show();

  $dataCatType = $(this).attr('data-cat-type');
  console.log($dataCatType);
  $(".standardtaskcheckboxwrapper." + $dataCatType).show();
  $(".standardtaskcheckboxwrapper." + 'all').show();

});
`
我现在遇到的问题是,当您在类别收音机cat-3中选择时,它会正确过滤,但当您随后也将语言设置为例如nl时,它会显示与nl相关的所有类别。我知道这对于现在的代码来说是正确的行为,但我不知道如何调整它以使两个过滤器一起工作。谢谢大家帮助我

只需将它们链接在一起,并删除重复行$.standardtaskcheckboxwrapper.hide;像这样:

$('input[type=radio][name=languagefilter], input[type=radio][name=associateddomain]').change(function() {

  $language = this.value;
  $(".standardtaskcheckboxwrapper").hide();
  $(".standardtaskcheckboxwrapper." + $language).show();

  $dataCatType = $(this).attr('data-cat-type');
  console.log($dataCatType);
  $(".standardtaskcheckboxwrapper." + $dataCatType).show();
  $(".standardtaskcheckboxwrapper." + 'all').show();

});

只需将它们链接在一起,并删除重复行$.standardtaskcheckboxwrapper.hide;像这样:

$('input[type=radio][name=languagefilter], input[type=radio][name=associateddomain]').change(function() {

  $language = this.value;
  $(".standardtaskcheckboxwrapper").hide();
  $(".standardtaskcheckboxwrapper." + $language).show();

  $dataCatType = $(this).attr('data-cat-type');
  console.log($dataCatType);
  $(".standardtaskcheckboxwrapper." + $dataCatType).show();
  $(".standardtaskcheckboxwrapper." + 'all').show();

});
$'input[type=radio][name=languagefilter]'{ 滤器 }; $'input[type=radio][name=associateddomain]'。changefunction{ 滤器 }; 函数滤波器{ $language=$'input[name=languagefilter]:选中'.val; $dataCatType=$'input[name=associateddomain]:选中'.val; $language=$language?+$language:; $dataCatType=$dataCatType+$dataCatType: $.standardtaskcheckboxwrapper.hide; $$language+$dataCatType.show; } n1 判定元件 EN 第一类 第二类 第三类 第四类 1. 2. 3. 4. 5. 6. 7. 8. 9 10 11 $'input[type=radio][name=languagefilter]'{ 滤器 }; $'input[type=radio][name=associateddomain]'。changefunction{ 滤器 }; 函数滤波器{ $language=$'input[name=languagefilter]:选中'.val; $dataCatType=$'input[name=associateddomain]:选中'.val; $language=$language?+$language:; $dataCatType=$dataCatType+$dataCatType: $.standardtaskcheckboxwrapper.hide; $$language+$dataCatType.show; } n1 判定元件 EN 第一类 第二类 第三类 第四类 1. 2. 3. 4. 5. 6. 7. 8. 9 10 11

请把我给你做的片段更新到a-我们需要你的收音机,你能更具体一点你到底想要什么吗?或者根据您的要求更新您的代码片段。请将我为您制作的代码片段更新到a-我们需要您的收音机。您能更详细地说明您到底想要什么吗?或者根据您的要求更新您的代码片段。我不知道您可以链接内容。太棒了!我要试试这个。我需要等一段时间才能做到,但我肯定会的。我不知道你可以连锁东西。太棒了!我要试试这个。我需要等一段时间才能做到,但我肯定会的。你的答案看起来也很有趣。让我也测试一下这个。对不起,它似乎不起作用。选择nl和cat4应该只返回4它返回1,2,3,4,11您想要的and运算符而不是or okey立即更新是的,我想我需要and运算符而不是or。但我是否误以为我在当前的snippit中找不到or?真的很好,它在snippit中工作得非常完美。不幸的是,当我使用代码时,我得到了一个意外的标识符。所以我有一些工作要做-你的答案看起来也很有趣。让我也测试一下这个。对不起,它似乎不起作用。选择nl和cat4应该只返回4它返回1,2,3,4,11您想要的and运算符而不是or okey立即更新是的,我想我需要and运算符而不是or。但我是否误以为我在当前的snippit中找不到or?真的很好,它在snippit中工作得非常完美。不幸的是,当我使用代码时,我得到了一个意外的标识符。所以我有一些工作要做-