元素没有隐藏

时间:2014-01-04 15:27:37

标签: jquery meteor

元素没有隐藏。我使用jQuery来做到这一点。 我的.html文件中有这一行

<template name="index">
   <div class="main">
      //Here some "main" code
   </div>
   <div class="testing">
      //Here some "testing" code
   </div>
   {{hide}}
</template>

我想隐藏&#34;测试&#34;通过jQuery。 在client / client.js中,我得到了:

Template.index.hide = function(){
$(".testing").hide();
}

它不起作用:C。 jQuery连接到此页面*
感谢。

2 个答案:

答案 0 :(得分:1)

试试这个:

<强>的jQuery

 $(function () {
   $(".testing").hide();
   $(".testing").css({'display':'none'});
});

VIA CSS

.testing{display:none;}

OR

威盛HTML

<div class="testing" style="display:none;">

答案 1 :(得分:0)

尝试hide().trigger('hide');

此外,除非您致电Template.index.hide();,否则代码将无法执行。

相关问题