我无法用jQuery隐藏我的段落

I can't hide my paragraph with jQuery

本文关键字:隐藏 我的 段落 jQuery      更新时间:2023-09-26

嗨,伙计们,我无法隐藏我的段落,我不知道为什么。

这是 mi jsfiddle

和我的代码:

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title> Ejemplo 1</title>
    </head>
    <body>
            <p id="paragraph">This is Sparta</p>
            <script type="text/javascript" src="js/jquery.js"></script>
            <script type="text/javascript" src="js/hide.js"></script>
    </body>
</html>

    $('#paragraph').click(function)  {

    $('#paragraph').hide();
});

下面是您对"如何使用jQuery单击时隐藏ID元素"的答案,这可能是您的问题标题。

答:

$('#paragraph').click(function() {
    $('#paragraph').hide(500);
});

同样在你的小提琴中,你没有加载jQuery!

<script src="//code.jquery.com/jquery-1.11.2.min.js"></script>

这是您更新的工作小提琴。

https://jsfiddle.net/0xhg57e4/3/