php变量转换为jquery隐藏函数


php variable into jquery hide function

有人能帮忙吗?

我有点像

<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中的类插入到隐藏函数中?

这样做

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

试试这个:

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

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

让我知道是否有用