【问题标题】:php variable into jquery hide functionphp变量到jquery隐藏函数中
【发布时间】:2013-11-28 16:29:04
【问题描述】:

有人可以帮忙吗

我有类似的东西

<div class="hidearea<?php echo $number?>">Example text Example text Example text Example text Example text </div>
<script> $( '.hidearea<?php echo $number?>' ).hide();  </script>

如何将 div 中的类插入到隐藏函数中?

【问题讨论】:

  • 在文件准备好的时候做
  • @SHIN 因为他的脚本在元素之后,所以它应该按原样工作。
  • 您编写的代码有什么问题?我认为它应该有效。

标签: php jquery html hide


【解决方案1】:

做一些这样的事情

$(function() {
    $( '.hidearea<?php echo $number?>' ).hide();
});

</script>

【讨论】:

    【解决方案2】:

    试试这个:

    $(document).ready(function(e) {
        $( '.hidearea<?php echo $number; ?>' ).hide();
                   // And don't forget ^ both times
    });
    

    注意:不应该是 ID 而不是 CLASS 吗? 注意 2: 你不能在你的样式表中设置display: none 吗?

    如果有用请告诉我

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-01-03
      • 2014-04-09
      • 1970-01-01
      • 1970-01-01
      • 2011-09-20
      • 1970-01-01
      • 2012-11-05
      相关资源
      最近更新 更多