JavaScript js 引入CDN 不生效 注意事项

【博客园cnblogs笔者m-yb原创,转载请加本文博客连接,笔者github: https://github.com/mayangbo666,公众号aandb7,QQ群927113708】
https://www.cnblogs.com/m-yb/p/10075717.htmlhtml

js能够用引入cdn替代引入js本地文件的方式, 使用一些js工具;前端

引入某个工具的cdn能够远程使用到js工具的函数/特性;jquery

今天博主在写一个html引入jquery的cdn时,git

好比引入这个站点的cdn:github

staticfile // 站点ide

网站提供的是这样的:函数

<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js">
</script>工具

 

可是博主写成了这样:网站

<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js" />this

发现原本能用的jquery js函数不能使用了,

但愿你们能注意到这点.

 

最后, 贴代码, 楼主对前端不熟, 你们不要喷我.

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>test-mayangbo666(github.com)</title>
</head>
<body>

    <p>若是你点我, 我就会消失</p>
    <p>继续点我</p>
    <p>接着点我</p>

    <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>

    <script>
        $(function () {

            $('p').click(function () {
                $(this).hide();
            })


        })
    </script>
</body>
</html>

相关文章
相关标签/搜索