Javascript错误window.setInterval

时间:2018-01-31 12:48:13

标签: javascript error-handling

我编写了一个仪表板,它是对用户输入的响应。例如,有一个专家模式,有经验的用户使用我们的模型可以添加高级内容。只有在用户选中“显示专家模式”时才会显示专家模式。

我的代码有效,但会产生很多错误:

window.setInterval(function(){
  if (document.getElementById("expertmodus").checked == true) {
    document.getElementById("allbranches").querySelector(".col-sm-6").className = "col-sm-4";
    document.getElementById("Mitte").querySelector(".col-sm-6").className = "col-sm-4";
  } else {}
}, 1);

window.setInterval(function(){
  if (document.getElementById("expertmodus").checked == false) {
    document.getElementById("allbranches").querySelector(".col-sm-4").className = "col-sm-6";
    document.getElementById("Mitte").querySelector(".col-sm-4").className = "col-sm-6";
  } else {}
}, 1);

这是我的代码,非常简单。有经验的javascript程序员如何处理这个问题?

祝你好运 马库斯

1 个答案:

答案 0 :(得分:0)

不幸的是,这是一款R-Shiny应用程序。我猜这段代码在这里没有意义。

materialSwitch(inputId = "expertmodus", label = "Experteneinstellungen sind ausgeblendet", status = "primary", right = TRUE)