jquery - 在 HTML 中的 <script src =""></script> 标记的 src 路径中上一层

标签 jquery html

我的文件夹结构如下。

enter image description here

我在 html_files 文件夹中有 index.html 文件。

我在我的 index.html 文件中使用如下脚本标记。

enter image description here

但是 jQuery 函数 hide() 不起作用。我在这里做错了什么吗..?请帮助我。提前致谢。

最佳答案

您需要确保您的 hide() 调用已绑定(bind)到事件。 $(document).ready() 的简写应该可以帮助您:

$(function() {
  $('h1').hide();
});

引用http://learn.jquery.com/using-jquery-core/document-ready/了解更多信息。

关于jquery - 在 HTML 中的 <script src =""></script> 标记的 src 路径中上一层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51820839/

相关文章:

javascript - 在不刷新页面的情况下插入记录后显示 <select> 选项

c# - 将数据从 jQuery POST/GET 到 MVC 4 Controller 并返回 View 的最佳方法

javascript - 在函数中设置默认变量值

css - 如何设置 html5 日期输入的样式,第一个元素 focus/active

javascript - 清理了 SQL/PHP,它没有写入。不会选择你的 CSS

javascript - JS & Jquery : functions goes crazy after being called.

javascript - 使用 JQuery 将 IE(Internet Explorer)中的 'save as' 类型更改为 .xls 对话框

JavaScript 验证文件不起作用 : "ReferenceError: validateForm is not defined" (html linked)

html - 在不同的方向、HTML、CSS 中证明 td 内的多个元素

html - XSLT - HTML 转换中的多个模板