Eugene Gluhotorenko
Eugene Gluhotorenko

Reputation: 3164

iPad Safari does not fire blur event

I have an html input text element in my application with jQuery blur event handler:

$('#textBox').blur(function () { console.log('blur'); })

When I click on a page area out of the textbox, desktop browsers fire this event, but iPad Safari does not. And neither the keyboard nor the cursor does not disappear. Are there any ways to "enable" the blur event ?

Upvotes: 16

Views: 5860

Answers (2)

Kevin Farrugia
Kevin Farrugia

Reputation: 7469

Workaround (albeit not recommended): https://codepen.io/kevinfarrugia/pen/rKpRBL

document.getElementById("container").addEventListener("click", () => {
  document.getElementById("container").focus();
});

Upvotes: 0

frankenthumbs
frankenthumbs

Reputation: 56

By design, a tap away will remove the hover state but the textbox will remain focused.

Safari Web Content Guide should help you develop for Safari on IOS devices.

Upvotes: 4

Related Questions