Javascript JS/jQuery在页面加载时显示DIV,单击时隐藏

Javascript JS/jQuery在页面加载时显示DIV,单击时隐藏,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我想在页面第一次加载时显示DIV,当单击侧栏菜单时,我将消失。我自己的代码是,每当单击菜单(重新加载页面)时,DIV总是最近出现和消失 对不起,我的英语不好 if (isset($_GET['ex'])) { test(); <script> $("#hello").hide(1000); </script> } if(isset($\u GET['ex'])) { test(

我想在页面第一次加载时显示DIV,当单击侧栏菜单时,我将消失。我自己的代码是,每当单击菜单(重新加载页面)时,DIV总是最近出现和消失

对不起,我的英语不好

if (isset($_GET['ex'])) 
{
test();                         
<script>
    $("#hello").hide(1000);                 
</script>
}
if(isset($\u GET['ex']))
{
test();
$(“#你好”).hide(1000);
}
类似这样的内容:

<?php
if (isset($_GET['ex'])) {
test();
?>
<script>
$(function() {
    $("#hello").show();
    $("#sideBar").click(function() {
        $('#hello').hide(1000);
    });
});
</script>
<?php
    }
?>

$(函数(){
$(“#你好”).show();
$(“#侧边栏”)。单击(函数(){
$('hello').hide(1000);
});
});