Basic

jQuery is a library, or set of helpful add-ons, to the JavaScript programming language.

  • basic syntax:
$(document).ready(function() {
    $("#id").fadeOut(1000);
});
  • link to html:
<head>
    <script type="text/javascript" src="script.js"></script>
</head>
  • about $(document).ready(); :
    • $() tell that jQuery things are about to happen
    • Putting document between the parentheses tells us that we’re about to work on the HTML document itself.
    • .ready(); is a function, or basic action, in jQuery. It says “hey, I’m going to do stuff as soon as the HTML document is ready!”
    • Whatever goes in .ready()’s parentheses is the jQuery event that occurs as soon as the HTML document is ready.
    • So, $(document).ready(something); says: “when the HTML document is ready, do something!”
  • Insert Elements: .append() inserts the specified element as the last child of the target element. .prepend() inserts the specified element as the first child of the target element.
發佈了57 篇原創文章 · 獲贊 3 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章