六角學院 - HexSchool
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # jQuery Code Snippets 常用速查表 > 適用於 VS Code 擴充套件:**[jQuery Code Snippets](https://marketplace.visualstudio.com/items?itemName=donjayamanne.jquerysnippets)**(by Don Jayamanne) ## 安裝方式 1. VS Code 按 `Cmd+Shift+X`(Mac)或 `Ctrl+Shift+X`(Windows/Linux)開啟擴充功能 2. 搜尋 **jQuery Code Snippets** 3. 點擊 **Install** 安裝 4. 在 JS 檔案中輸入 `jq` 即可看到下拉選單 ![截圖 2026-03-19 下午3.12.19](https://hackmd.io/_uploads/HyWJzQK5Zl.png) --- ## 文件就緒 | 前綴 | 說明 | |------|------| | `jqDocReady` | `$(document).ready(function() { ... });` | | `jqDocReadyShort` | `$(function() { ... });` | ## 事件處理 | 前綴 | 說明 | |------|------| | `jqClick` | 綁定 click 事件 | | `jqChange` | 綁定 change 事件 | | `jqSubmit` | 綁定 submit 事件 | | `jqSubmitTrigger` | 觸發 submit 事件 | | `jqFocus` | 綁定 focus 事件 | | `jqBlur` | 綁定 blur 事件 | | `jqHover` | 綁定 mouseenter / mouseleave | | `jqKeyDown` | 綁定 keydown 事件 | | `jqKeyUp` | 綁定 keyup 事件 | | `jqKeyPress` | 綁定 keypress 事件 | | `jqMouseEnter` | 綁定 mouseenter 事件 | | `jqMouseLeave` | 綁定 mouseleave 事件 | | `jqOn` | 使用 `.on()` 綁定事件 | | `jqOne` | 綁定只觸發一次的事件 | | `jqOneWithData` | 帶資料的一次性事件 | ### jqOn 常見事件範例 ```javascript // 點擊 $(selector).on('click', function() { ... }); // 雙擊 $(selector).on('dblclick', function() { ... }); // 滑鼠事件 $(selector).on('mouseenter', function() { ... }); $(selector).on('mouseleave', function() { ... }); $(selector).on('mouseover', function() { ... }); $(selector).on('mouseout', function() { ... }); $(selector).on('mousemove', function() { ... }); $(selector).on('mousedown', function() { ... }); $(selector).on('mouseup', function() { ... }); // 鍵盤事件 $(selector).on('keydown', function() { ... }); $(selector).on('keyup', function() { ... }); $(selector).on('keypress', function() { ... }); // 表單事件 $(selector).on('submit', function() { ... }); $(selector).on('change', function() { ... }); $(selector).on('focus', function() { ... }); $(selector).on('blur', function() { ... }); $(selector).on('input', function() { ... }); $(selector).on('select', function() { ... }); // 視窗事件 $(window).on('resize', function() { ... }); $(window).on('scroll', function() { ... }); $(window).on('load', function() { ... }); // 事件委派(動態元素適用) $(parentSelector).on('click', childSelector, function() { ... }); // 綁定多個事件 $(selector).on('mouseenter mouseleave', function() { ... }); // 帶命名空間(方便解除) $(selector).on('click.myPlugin', function() { ... }); $(selector).off('click.myPlugin'); ``` | `jqTrigger` | 觸發事件 | | `jqTriggerWithData` | 帶資料觸發事件 | | `jqTriggerHandler` | 觸發事件處理器 | | `jqBind` | 綁定事件(舊版) | | `jqBindWithData` | 帶資料綁定事件 | | `jqUnbind` | 解除事件綁定 | | `jqUnbindAll` | 解除所有事件綁定 | | `jqResize` | 綁定 resize 事件 | | `jqScroll` | 綁定 scroll 事件 | | `jqSelect` | 綁定 select 事件 | ## DOM 操作 | 前綴 | 說明 | |------|------| | `jqFind` | 尋找子元素 | | `jqEach` | 遍歷陣列或物件 | | `jqEachElement` | 遍歷 jQuery 物件中的每個元素 | | `jqAppend` | 在內部末尾插入內容 | | `jqAppendTo` | 將元素插入目標末尾 | | `jqPrepend` | 在內部開頭插入內容 | | `jqPrependTo` | 將元素插入目標開頭 | | `jqAfter` | 在元素後面插入 | | `jqBefore` | 在元素前面插入 | | `jqInsertAfter` | 將元素插入到目標後面 | | `jqInsertBefore` | 將元素插入到目標前面 | | `jqRemove` | 移除元素 | | `jqRemoveExp` | 帶過濾條件移除元素 | | `jqEmpty` | 清空子元素 | | `jqClone` | 複製元素 | | `jqCloneWithEvents` | 複製元素(含事件) | | `jqReplaceWith` | 替換元素 | | `jqReplaceAll` | 用匹配元素替換目標 | | `jqWrap` | 包裹元素 | | `jqWrapAll` | 包裹所有匹配元素 | | `jqWrapInner` | 包裹元素內容 | | `jqMap` | 陣列映射 | ## 取得 / 設定內容與屬性 | 前綴 | 說明 | |------|------| | `jqTextGet` | 取得文字內容 | | `jqTextSet` | 設定文字內容 | | `jqHtmlGet` | 取得 HTML 內容 | | `jqHtmlSet` | 設定 HTML 內容 | | `jqValGet` | 取得表單值 | | `jqValSet` | 設定表單值 | | `jqAttrGet` | 取得屬性 | | `jqAttrSet` | 設定屬性 | | `jqAttrSetObj` | 用物件設定多個屬性 | | `jqAttrSetFn` | 用函式設定屬性 | | `jqAttrRemove` | 移除屬性 | | `jqDataGet` | 取得 data 資料 | | `jqDataSet` | 設定 data 資料 | | `jqDataSetObj` | 用物件設定 data | | `jqDataRemove` | 移除 data 資料 | ## CSS 與尺寸 | 前綴 | 說明 | |------|------| | `jqCssGet` | 取得 CSS 屬性值 | | `jqCssSet` | 設定 CSS 屬性 | | `jqCssSetObj` | 用物件設定多個 CSS | | `jqClassAdd` | 新增 class | | `jqClassRemove` | 移除 class | | `jqClassToggle` | 切換 class | | `jqClassToggleSwitch` | 帶開關切換 class | | `jqHasClass` | 檢查是否有 class | | `jqWidthGet` | 取得寬度 | | `jqWidthSet` | 設定寬度 | | `jqHeightGet` | 取得高度 | | `jqHeightSet` | 設定高度 | | `jqInnerWidth` | 取得內部寬度(含 padding) | | `jqInnerHeight` | 取得內部高度(含 padding) | | `jqOuterWidth` | 取得外部寬度(含 border) | | `jqOuterHeight` | 取得外部高度(含 border) | | `jqOffsetGet` | 取得元素座標 | | `jqOffsetParent` | 取得最近定位祖先 | | `jqPosition` | 取得相對位置 | | `jqScrollTopGet` | 取得垂直捲軸位置 | | `jqScrollTopSet` | 設定垂直捲軸位置 | | `jqScrollLeftGet` | 取得水平捲軸位置 | | `jqScrollLeftSet` | 設定水平捲軸位置 | ## 動畫效果 | 前綴 | 說明 | |------|------| | `jqShow` | 顯示元素 | | `jqShowFull` | 顯示元素(完整參數) | | `jqHide` | 隱藏元素 | | `jqHideFull` | 隱藏元素(完整參數) | | `jqToggle` | 切換顯示/隱藏 | | `jqToggleFull` | 切換(完整參數) | | `jqFadeIn` | 淡入 | | `jqFadeInFull` | 淡入(完整參數) | | `jqFadeOut` | 淡出 | | `jqFadeOutFull` | 淡出(完整參數) | | `jqFadeTo` | 淡到指定透明度 | | `jqFadeToFull` | 淡到透明度(完整參數) | | `jqSlideDown` | 向下滑動顯示 | | `jqSlideDownFull` | 向下滑動(完整參數) | | `jqSlideUp` | 向上滑動隱藏 | | `jqSlideUpFull` | 向上滑動(完整參數) | | `jqSlideToggle` | 滑動切換 | | `jqSlideToggleFull` | 滑動切換(完整參數) | ## AJAX | 前綴 | 說明 | |------|------| | `jqAjax` | 完整 AJAX 請求 | | `jqAjaxAspNetWebService` | ASP.NET Web Service 請求 | | `jqGet` | HTTP GET 請求 | | `jqPost` | HTTP POST 請求 | | `jqGetJson` | 取得 JSON 資料 | | `jqGetScript` | 動態載入腳本 | | `jqLoadGet` | 用 GET 載入 HTML | | `jqLoadPost` | 用 POST 載入 HTML | ## 其他 | 前綴 | 說明 | |------|------| | `func` | 匿名函式 | | `jqPlugin` | jQuery Plugin 模板 | | `jqNamespace` | Namespace 模板 |

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully