From dad72589ee62d9463aedae1679cc21143514cd19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=AD=A4=E4=B8=9C?= <3352403143@qq.com> Date: Fri, 2 Dec 2022 12:49:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../2022.12.1/1.html" | 24 +++++++++++ .../JQuery\346\226\271\346\263\225.md" | 40 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 "33\347\275\227\346\255\244\344\270\234/2022.12.1/1.html" create mode 100644 "33\347\275\227\346\255\244\344\270\234/2022.12.1/JQuery\346\226\271\346\263\225.md" diff --git "a/33\347\275\227\346\255\244\344\270\234/2022.12.1/1.html" "b/33\347\275\227\346\255\244\344\270\234/2022.12.1/1.html" new file mode 100644 index 0000000..310d200 --- /dev/null +++ "b/33\347\275\227\346\255\244\344\270\234/2022.12.1/1.html" @@ -0,0 +1,24 @@ + + + + + + + Document + + + + + + + \ No newline at end of file diff --git "a/33\347\275\227\346\255\244\344\270\234/2022.12.1/JQuery\346\226\271\346\263\225.md" "b/33\347\275\227\346\255\244\344\270\234/2022.12.1/JQuery\346\226\271\346\263\225.md" new file mode 100644 index 0000000..42ccc8d --- /dev/null +++ "b/33\347\275\227\346\255\244\344\270\234/2022.12.1/JQuery\346\226\271\346\263\225.md" @@ -0,0 +1,40 @@ +# JQuery方法 + +eq():跟据下标找元素,从0开始 + +$('').eq() + + + +detach():保留事件 + +```js + var $btn = $('button').eq(2).detach(); + $('button').eq(1).click(function () { + $(this).after($btn); + }) +``` + + + +clone(bool):返回一个复制元素,默认是false:只克隆元素。不克隆事件,参数为bool=true:表示将事件一起复制, + +```js + $('button').eq(4).click( + function () { + var $btn3 = $('button').eq(2).clone(true); + $(this).after($btn3); + } + ) +``` + + + +replaceWith():替换jQuery对象 + +```js +$('button').eq(3).replaceWith($('')) +``` + + + -- Gitee