Reputation: 15
In my pop up dialog box I'm using jquery live() to change the value of the textarea when it loses the focus (blur event). When I close the dialog by clicking the cancel button it works fine in desktop browsers, but in my ipad devices, when i tired to close the dialog by clicking the cancel button the following behaviour occurs
1) on my first tap, the blur event is called and the textarea value changes (virtual keypad also hides).
2) on second tap, the pop up window closes.
Note : when I makes the value attribute of the textarea on blur event to null. it works fine in ipad devices.
I want the pop up to be closed on single tap itself.
Upvotes: 1
Views: 247
Reputation: 417
Some suggestions.
Try stopping propagation and default event:
$("some_element").on('click', function(ev) { ev.stopPropagation(); ev.preventDefault(); /* Your code here */ return false;});
Are you trying to create a placeholder text for the input ? If so you can use the "placeholder" attribute in HTML5 to implement this without any scripts.
Upvotes: 1