jQuery不与HTML文件链接 [英] jQuery not linking with HTML file

查看:112
本文介绍了jQuery不与HTML文件链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习编程,并且遇到了一些应该很简单的事情,但是让我感到沮丧的是三天。

I'm learning to program and have faced something that should be very simple but have taken me three days of frustration.

我似乎无法得到jQuery文件链接到我的HTML。

I can't seem to get the jQuery file to link with my html.

这是我的HTML:

<html>
<head>
    <title>Title</title>
    <link type="text/css" rel="stylesheet" href="stylesheet.css"/>

    <script src="/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="/script.js"></script>
</head>     
    <body>
    <div class="heads">
        <div id="about">
            <p>About.</p>
        </div>
        <div id="work">
            <p>Work.</p>
        </div>
        <div id="contact">
            <p>Contact.</p>
        </div>
    </div>
    </body>

这里是jQuery:

And here is the jQuery:

$(document).ready(function() {
    $('div').click(function() {
        $(this).fadeOut('fast');
    });
});

它不是最终的jQuery,但我确定它是假设能够工作的。

It it not the final jQuery, but I was sure it was suppose to work.

预先感谢您!

推荐答案

<script src="/jquery-2.0.3.min.js"></script>
<script src="/script.js"></script>

文件路径错误。你不使用任何子文件夹。它应该是:

The path to your files is wrong. You don't use any subfolder. It should be:

<script src="jquery-2.0.3.min.js"></script>
<script src="script.js"></script>

这为我解决了问题:)
开心编码

This fixed the problem for me :) happy coding

这篇关于jQuery不与HTML文件链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆