Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/366.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 MaterializeCSS选项卡实例返回未定义_Javascript_Materialize - Fatal编程技术网

Javascript MaterializeCSS选项卡实例返回未定义

Javascript MaterializeCSS选项卡实例返回未定义,javascript,materialize,Javascript,Materialize,我试着用步骤做标签,并使用一些触发按钮 但是我的tab实例返回undefined,因为我不能使用所有的方法 var TabInstance = M.Tabs.getInstance(document.querySelectorAll('.tabs')); var nextStep = document.querySelectorAll('.next-step'), nS; for (nS = 0; nS < nextStep.length; ++nS) {

我试着用步骤做标签,并使用一些触发按钮

但是我的tab实例返回undefined,因为我不能使用所有的方法

   var TabInstance = M.Tabs.getInstance(document.querySelectorAll('.tabs'));
   var nextStep = document.querySelectorAll('.next-step'), nS;

   for (nS = 0; nS < nextStep.length; ++nS) {
      nextStep[nS].addEventListener('click', function(e) {

        alert(TabInstance) // undefined

        var 
        where = this.getAttribute("href"),
        newWhereWithoutHash = where.replace('#', '');

        TabInstance.select(newWhereWithoutHash); // Uncaught TypeError: Cannot read property 'select' of undefined
       });
   }
var TabInstance=M.Tabs.getInstance(document.querySelectorAll('.Tabs');
var nextStep=document.querySelectorAll('.next step'),nS;
对于(nS=0;nS
您解决过这个问题吗?有类似的问题。@Chiperific是的,getInstance()方法只允许一个元素,您可以给出ID或specfic类,然后调用此方法。您解决过这个问题吗?有类似的问题。@Chiperific是的,getInstance()方法只允许一个元素,您可以给出ID或specfic类,然后调用此方法。