日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

div无法触发blur事件解决的方法

發(fā)布時(shí)間:2024/7/19 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 div无法触发blur事件解决的方法 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

默認(rèn)情況下div無(wú)法獲取焦點(diǎn),無(wú)法觸發(fā)focus與blur事件,推測(cè)span,a等標(biāo)簽也無(wú)法觸發(fā)焦點(diǎn)事件(input:button。及button標(biāo)簽?zāi)軌蛴|發(fā))

怎樣使div觸發(fā)blur事件:能夠給div加上tabindex屬性

在線演示:http://sandbox.runjs.cn/show/e0bvfcag

源代碼:

<!DOCTYPE html> <html lang="en"> <head><meta charset="UTF-8"><title>Document</title><style>.box{width: 200px;height: 200px;background-color: #3295F2;}</style><script type="text/javascript" src="http://sandbox.runjs.cn/uploads/rs/294/c4c2o6mh/jquery.js"></script> </head> <body><input type="text" /><input type="button" value="測(cè)試" class="but"/><button>kkk</button><div class="box" tabindex="1"></div><script>$('.box').focus(function(){alert('div focus');});$('.box').blur(function(){alert('div blur');});$('.but').focus(function(){alert('but');});$('.but').blur(function(){alert('but');});$('button').focus(function(){alert('but');});$('button').blur(function(){alert('but');});</script> </body> </html>


相關(guān)資料:http://www.w3school.com.cn/tags/att_standard_tabindex.asp

demo: ?http://www.w3school.com.cn/tiy/t.asp?

f=html_standard_tabindex



轉(zhuǎn)載于:https://www.cnblogs.com/mengfanrong/p/5190108.html

總結(jié)

以上是生活随笔為你收集整理的div无法触发blur事件解决的方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。