如何将JQuery用于在PHP if条件中创建的标记
如何对在PHP if条件中创建的标记使用JQuery。 假设我喜欢在fadeIn函数动画的if条件结果为true时显示一个p标记。 你能给我举个例子吗??如何将JQuery用于在PHP if条件中创建的标记,php,jquery,Php,Jquery,如何对在PHP if条件中创建的标记使用JQuery。 假设我喜欢在fadeIn函数动画的if条件结果为true时显示一个p标记。 你能给我举个例子吗?? 非常感谢您可以使用以下工具 <?php if(condition == true) { ?> <script> $("#yourElement").show(); </script> <?php } else { ?> <script> $("#yourElement").hi
非常感谢您可以使用以下工具
<?php
if(condition == true) {
?>
<script>
$("#yourElement").show();
</script>
<?php
} else {
?>
<script>
$("#yourElement").hide();
</script>
<?php
}
?>
$(“#yourElement”).show();
$(“#yourElement”).hide();
您可以输出
标记,并在样式表中为该元素定义一个显示:none
。然后,您可以通过客户端的jquery选择它,并在其上使用fadeIn()
方法。