最简单的测试Jquery-jquery是否正常工作的代码

01-运行后在页面上显示“jQuery is working!”

代码如下:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>it is title</title>
    <meta name="viewport" content="width=device-width,initial-scale=1, shrink-to-fit=no">
    <script src="E:/HTML_code/static/jquery-3.5.1.slim.js"></script>
</head>
<body>

<div id="resultMessage"></div>

<script>
    $(document).ready(function() {
        $("#resultMessage").text("jQuery is working!");
    });
</script>

</body>
</html>

运行后效果如下:
在这里插入图片描述

02-运行后在F12调试模式的控制台(Console)打印输出“jQuery is working!”

DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>it is titletitle>
    <meta name="viewport" content="width=device-width,initial-scale=1, shrink-to-fit=no">
    <script src="E:/HTML_code/static/jquery-3.5.1.slim.js">script>
head>
<body>

<script>
    console.log('jQuery is working!'); 
script>

body>
html>

运行效果如下:
最简单的测试Jquery-jquery是否正常工作的代码_第1张图片

你可能感兴趣的:(JavaScript,jquery,前端,javascript)