From a0136f5cbeeeaf164f331e7cb80935a2b7d08c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E9=91=AB=E6=B6=9B?= <1722781630@qq.com> Date: Sun, 4 Dec 2022 20:13:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=8D=81=E4=B8=89?= =?UTF-8?q?=E6=AC=A1=E4=BD=9C=E4=B8=9A=E5=92=8C=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../22.html" | 121 ++++++++++++++++++ .../JQuery.md" | 61 +++++++++ 2 files changed, 182 insertions(+) create mode 100644 "45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-11-30\344\275\234\344\270\232/22.html" create mode 100644 "45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-11-30-JQuery\347\254\224\350\256\260/JQuery.md" diff --git "a/45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-11-30\344\275\234\344\270\232/22.html" "b/45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-11-30\344\275\234\344\270\232/22.html" new file mode 100644 index 0000000..d3d4ea3 --- /dev/null +++ "b/45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-11-30\344\275\234\344\270\232/22.html" @@ -0,0 +1,121 @@ + + + + + 注册表单验证 + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
用户注册
用户名: + +
密码: + +
密码确认: + +
性别: + 男 + 女 + +
专业: + + +
爱好: + 抽烟 + 喝酒 + 打游戏 + 烫头发 + 足球 + 篮球 + +
自我介绍: + +
  + + +
+ +
+ + + \ No newline at end of file diff --git "a/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-11-30-JQuery\347\254\224\350\256\260/JQuery.md" "b/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-11-30-JQuery\347\254\224\350\256\260/JQuery.md" new file mode 100644 index 0000000..f8a8407 --- /dev/null +++ "b/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-11-30-JQuery\347\254\224\350\256\260/JQuery.md" @@ -0,0 +1,61 @@ +# JQuery + +#### 事件对象 + +事件对象什么时候产生:触发事件的时候 this + +###### 事件绑定 + +1.直接绑定 + +2.事件的链式调用,为一个对象绑定多个事件 + +``` + $('button').mouseover( + function () { + $(this).css('color','red'); + } + ).mouseout( + function () { + $(this).css('color','black'); + } + ).click( + function () { + console.log('click'); + } + ) +``` + +3.bind():可以为多个事件绑定同一个函数 + +``` +$('button').bind('click ',function () { + console.log('这是bind'); + }) +``` + +4.on():绑定 + +on可以为动态添加的元素进行事件绑定 + +``` + $('.newdiv').click(function () { + var $btn = $(''); + $(this).append($btn); + console.log('这是在div中'); + }) + + $(document).on('click','button',function () { + console.log('这是新创建的元素'); + }) +``` + +5.one:只触发一次事件 + +最后一个-1 倒数第二个-2 + +$('button').eq(-1).one('click',function () { + + alert('一次事件'); + +}) \ No newline at end of file -- Gitee From dd7a6e51a53ae3c7782792e12be68c9bc9006ab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E9=91=AB=E6=B6=9B?= <1722781630@qq.com> Date: Sun, 4 Dec 2022 20:14:55 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E7=AC=AC=E4=BA=8C=E5=8D=81=E5=9B=9B?= =?UTF-8?q?=E6=AC=A1=E4=BD=9C=E4=B8=9A=E5=92=8C=E7=AC=94=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../23.html" | 24 ++++++++++++++ .../JQuery\346\226\271\346\263\225.md" | 31 +++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 "45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-12-1\344\275\234\344\270\232/23.html" create mode 100644 "45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-12-1-JQuery\346\226\271\346\263\225\347\254\224\350\256\260/JQuery\346\226\271\346\263\225.md" diff --git "a/45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-12-1\344\275\234\344\270\232/23.html" "b/45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-12-1\344\275\234\344\270\232/23.html" new file mode 100644 index 0000000..310d200 --- /dev/null +++ "b/45\351\251\254\351\221\253\346\266\233/\344\275\234\344\270\232/2022-12-1\344\275\234\344\270\232/23.html" @@ -0,0 +1,24 @@ + + + + + + + Document + + + + + + + \ No newline at end of file diff --git "a/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-12-1-JQuery\346\226\271\346\263\225\347\254\224\350\256\260/JQuery\346\226\271\346\263\225.md" "b/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-12-1-JQuery\346\226\271\346\263\225\347\254\224\350\256\260/JQuery\346\226\271\346\263\225.md" new file mode 100644 index 0000000..b8e0b6a --- /dev/null +++ "b/45\351\251\254\351\221\253\346\266\233/\347\254\224\350\256\260/2022-12-1-JQuery\346\226\271\346\263\225\347\254\224\350\256\260/JQuery\346\226\271\346\263\225.md" @@ -0,0 +1,31 @@ +# JQuery方法 + +eq():跟据下标找元素,从0开始 + +$('').eq() + +detach():保留事件 + +``` + var $btn = $('button').eq(2).detach(); + $('button').eq(1).click(function () { + $(this).after($btn); + }) +``` + +clone(bool):返回一个复制元素,默认是false:只克隆元素。不克隆事件,参数为bool=true:表示将事件一起复制, + +``` + $('button').eq(4).click( + function () { + var $btn3 = $('button').eq(2).clone(true); + $(this).after($btn3); + } + ) +``` + +replaceWith():替换jQuery对象 + +``` +$('button').eq(3).replaceWith($('')) +``` \ No newline at end of file -- Gitee