简体   繁体   中英

JQuery is:focus not working in IE8

I check for focus on a text field with this:

if ($('#title').is(":focus"))

<input type="text" id="title" value="Write your post..." />

every other browser determines this as true, IE8 does not. Does this work in IE8?

This should work no matter what mode IE is running in:

if(document.getElementById('title')==document.activeElement)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM