JS實現點選空白處彈窗消失

2022-05-15 02:15:24 字數 1280 閱讀 6204

doctype html

>

<

html

lang

="en"

>

<

head

>

<

meta

charset

="utf-8"

>

<

meta

name

="viewport"

content

="width=device-width, initial-scale=1.0"

>

<

title

>點選空白處彈窗消失

title

>

<

style

>

*.input-text

.content

.hide

style

>

head

>

<

body

>

<

div

id>

<

input

type

="text"

class

="input-text"

/>

<

div

class

="content hide"

>

<

div>

<

button

type

="button"

>確定

button

>

div>

div>

div>

<

script

>

//事件委託就是利用事件冒泡特性,給父元素繫結事件

判斷是否是某個節點的子節點

觸發事件的源節點

document.onclick

=function

(e)else

}//自定義contains方法

varcuscontains

=function

(parnode,childnode)

childnode

=childnode.parentnode;

}return

false

; }

script

>

body

>

html

>

點選按鈕顯示,點選空白處隱藏

html text align center 多數情況下,8個領域中除了知識常識外的其他7個領域,都應優先學習 各個領域中的核心類技能優先學習,核心類技能中,技能年齡小的優先學習。button class xiaotieshi id btnshow value 選課貼士 js function 按鈕...

點選隱藏顯示和點選body空白處隱藏

doctype html html lang en head meta charset utf 8 title document title style type text css btn pop style head body a href j ascript class btn 點選 a div...

自定義元件 點選空白處隱藏

實現 顯示 ps 給自定義元件新增自定義事件 簡單介紹vue指令 乙個指令定義物件可以提供如下幾個鉤子函式 均為可選 bind 只呼叫一次,指令第一次繫結到元素時呼叫。在這裡可以進行一次性的初始化設定。inserted 被繫結元素插入父節點時呼叫 僅保證父節點存在,但不一定已被插入文件中 updat...