Questions tagged [onblur]

The blur event fires when an element loses focus.

The blur event fires when an element loses focus.

610 questions
137
votes
5 answers

jQuery: fire click() before blur() event

I have an input field, where I try to make autocomplete suggestion. Code looks like
On input's blur() event I want to hide results' div: $("#myinput").live('blur',function(){ …
Egor Sazanovich
  • 4,759
  • 5
  • 21
  • 36
127
votes
7 answers

How to use onBlur event on Angular2?

How do you detect an onBlur event in Angular2? I want to use it with Can anyone help me understand how to use it?
Ignat
  • 3,297
  • 6
  • 13
  • 17
126
votes
5 answers

onclick() and onblur() ordering issue

I have an input field that brings up a custom drop-down menu. I would like the following functionality: When the user clicks anywhere outside the input field, the menu should be removed. If, more specifically, the user clicks on a div inside the…
1''
  • 23,546
  • 28
  • 128
  • 192
56
votes
1 answer

blur event.relatedTarget returns null

I have an field and I need to clear it when this field loses focus (whiech means that user clicked somewhere on the page). But there is one exception. Input text field should't be cleared when user clicks on a specific element. I…
CMTV
  • 1,739
  • 1
  • 13
  • 23
43
votes
4 answers

Get the clicked object that triggered jquery blur() event

Suppose I do this: $(target).blur(function(e){ //do stuff }); Is there a way to fetch the object that was clicked on in order to trigger the blur action? I tried using e.target, but that appears to be returning the object attached to the blur…
pillarOfLight
  • 7,182
  • 15
  • 51
  • 82
42
votes
3 answers

Prevent firing the blur event if any one of its children receives focus

I have a div on a page that shows some info about a particular category (Image, Name etc). When I click on the edit image it puts the category into edit mode which allows me to update the name. As you can see from the image below it shows that…
Thwaitesy
  • 1,093
  • 2
  • 11
  • 14
40
votes
1 answer

Using onBlur with JSX and React

I am trying to create a password confirmation feature that renders an error only after a user leaves the confirmation field. I'm working with Facebook's React JS. This is my input component:
user3862066
  • 403
  • 1
  • 4
  • 4
31
votes
6 answers

How should I fire Javascript blur event after click event that causes the blur?

I have run into this problem a few times and I'm not happy with the solutions I've used before. I have an input box with a blur event that validates the content of it and a button which will fill the input box on click. The problem is clicking the…
Jake
  • 11,124
  • 13
  • 57
  • 91
29
votes
2 answers

Pausing setInterval when page/ browser is out of focus

I have a simple slideshow that I've made on a client's homepage, using setInterval to time the rotations. To prevent browsers from screwing up setInterval when the page isn't in focus (another tab is being viewed, or another programme), I'm…
Michael Watson
  • 989
  • 3
  • 13
  • 25
27
votes
3 answers

Updating a React Input text field with the value on onBlur event

I have the following input field as below. On blur, the function calls a service to update the input value to the server, and once that's complete, it updates the input field. How can I make it work? I can understand why it's not letting me change…
Suthan Bala
  • 2,774
  • 4
  • 29
  • 51
26
votes
6 answers

jQuery validation onblur

I am trying to get the jQuery validation working on a webpage I am creating. I have about 6 different fieldsets that contain the page's details. I am using this as I am hiding and showing them give a better user experience. I have the plugin working…
Diver Dan
  • 9,723
  • 22
  • 91
  • 160
24
votes
8 answers

Clicking on a div's scroll bar fires the blur event in I.E

I have a div that acts like a drop-down. So it pops-up when you click a button and it allows you to scroll through this big list. So the div has a vertical scroll bar. The div is supposed to disappear if you click outside of the div, i.e. on…
Riz
  • 5,680
  • 16
  • 56
  • 91
23
votes
3 answers

blur() vs. onblur()

I have a input tag with an onblur event listener: Via JavaScript, I want to trigger the blur event on this input so that it, in turn, calls the doSomething function. My initial thought…
DA.
  • 36,871
  • 47
  • 133
  • 201
21
votes
10 answers

How can I check if a value is changed on blur event?

Basically I need to check if the value is changed in a textbox on the 'blur' event so that if the value is not changed, I want to cancel the blur event. If it possible to check it the value is changed by user on the blur event of an input HTML…
pencilCake
  • 45,443
  • 73
  • 211
  • 346
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,095
  • 3
  • 38
  • 41
1
2 3
40 41