Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 ?

like image 634
Eugene Gluhotorenko Avatar asked Jun 06 '12 12:06

Eugene Gluhotorenko


People also ask

What triggers blur event?

The blur event fires when an element has lost focus. The main difference between this event and focusout is that focusout bubbles while blur does not. The opposite of blur is focus . This event is not cancelable and does not bubble.

How do you stop event blurs?

If you want to prevent the blur event from being fired, you have to do so when you are inside the mousedown event, you can do so by invoking the method preventDefault() on the event. Click the checkbox, focus input & then click the button, the textfield never loses focus now.

Is blur an event handler?

blur( [eventData ], handler ) An object containing data that will be passed to the event handler. A function to execute each time the event is triggered.


1 Answers

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.

like image 102
frankenthumbs Avatar answered Sep 19 '22 11:09

frankenthumbs