Questions tagged [onblur]

The blur event fires when an element loses focus.

The blur event fires when an element loses focus.

653 questions
18
votes
4 answers

jQuery $(window).blur vs native window.onblur

What are the advantages of using jQuery's $(window).blur(function() { ... }) to attach an event handler versus setting it directly with window.onblur = function() { ... } It seems that the latter is less robust because it only supports one blur…
Andrew Mao
  • 35,740
  • 23
  • 143
  • 224
18
votes
6 answers

How to blur the div element?

I have a dropdown menu inside a DIV. I want the dropdown to be hide when user click anywhere else. $('div').blur(function() { $(this).hide(); } is not working. I know .blur works only with but in this case what is the simplest solution?
Aamir Afridi
  • 6,364
  • 3
  • 42
  • 42
17
votes
5 answers

How to determine where focus went?

This has been asked here before, but several years ago, and there was no cross-platform solution at the time (other than the setTimeout solution, which is really not very handy). I'd like to do onblur="foo(parm);" and have foo be able to determine…
Jonathan M
  • 17,145
  • 9
  • 58
  • 91
16
votes
5 answers

How to get div onblur event to execute a javascript function?

Hi I have a div that contains three textboxes , i need a function to be called once the control is out of the div tag, I don't want to use the onclick event because the focus can be moved out of the div by pressing the tab key on the keyboard or…
Vamsi
  • 4,237
  • 7
  • 49
  • 74
16
votes
1 answer

How to remove focus from activeElement when changing tabs (onfocus/onblur)?

I'm trying to remove focus from a (jQuery Mobile) text input when a user switches tabs on desktop. While I can correctly identify the activeElement in the below console, I cannot edit any of its properties or remove its focus. This is what I'm…
frequent
  • 27,643
  • 59
  • 181
  • 333
15
votes
7 answers

tinyMCE blur event

Hello I want to do some stuff when user finished writing in the tinyMCE textarea and click somewhere outside (onBlur). So far I haver try: $('#id_topic_text_parent').live('blur',function(){ alert('asd') //I saw #id_topic_text_parent in firebug,…
T1000
  • 2,909
  • 7
  • 36
  • 53
14
votes
1 answer

Blurring app screen in switch mode on iOS

I want to use blurring in my iOS app when it switch. Like PayPal and some other financial app where need to hide information. But I can't find any information or hint about this feature. For example PayPal realization:…
Sul Tan
  • 143
  • 1
  • 5
13
votes
5 answers

What is the replacement of jQuery's blur event in AngularJS?

I have to close any opened component when clicking outside of that component using angularjs. Is there an angular directive for blur events? If not, how can I do that?
Habibur Rahman
  • 617
  • 3
  • 7
  • 11
12
votes
2 answers

onChange or onBlur to change the state in ReactJs?

//Assume am changing state in handleChange function. In case of onChange event state will update every character change. In case of onBlur event state will…
Amruth
  • 5,792
  • 2
  • 28
  • 41
12
votes
3 answers

jQuery onblur not working

$('#lPass').focus(function() { if (this.value == this.defaultValue) this.value = ''; $(this).after('').remove(); }).blur(function() { alert(1); });
Isis
  • 4,608
  • 12
  • 39
  • 61
11
votes
4 answers

Prevent onblur code to execute if clicked on submit button

By the following code I wish to "DO SOMETHING" on "ONBLUR" of element id="eg1" only if the onblur event was not caused due to "ONCLICK" on the submit button. $(document).ready(function() { $('#eg1').blur(function() { …
Palak Taneja
  • 1,983
  • 3
  • 13
  • 12
10
votes
2 answers

Document visibilitychange versus window blur/focus, what is the difference, when to use which?

In ECMAscript (=Javascript) there are two ways to check if the user is away from your page or not. You can either listen for a "visibilitychange" event on the document or you can listen for "blur" and "focus" events on the window. Is there a…
HolyResistance
  • 594
  • 1
  • 8
  • 26
10
votes
3 answers

google chrome does not fire blur event on radio buttons?

This is my first post here - hello everybody I am currently developing a html form with the support of css and jquery. The form will be used by 'unexperienced users' so my focus lies on good usability. Therefor I am providing a hint to every input…
mwallisch
  • 1,751
  • 2
  • 21
  • 29
10
votes
3 answers

Seems that onBlur of one element is "overriding" the onclick of another

I have two elements: and a dynamically created one (this is all part of an auto suggest program): $suggString .= '
linus72982
  • 1,418
  • 2
  • 16
  • 31
10
votes
2 answers

How to use relatedTarget (or equivalent) in IE?

Apparently IE (11) has an issue with relatedTarget, for example on blur events. Is there an alternative for IE to get the relatedTarget? Here is an example that produces an error in IE: https://jsfiddle.net/rnyqy78m/
Daniel
  • 3,383
  • 4
  • 30
  • 61
1
2
3
43 44