onblur

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

ぐ巨炮叔叔 提交于 2019-11-28 19:37:17
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 some other way. I would also like to know if there is a way to achieve this using any javascript libraries like jquery. Thank you, this is the sample html code <html> <head> <title>Div Onblur test</title> <script type="text/javascript"> function Callme() { alert("I am Called") } </script> </head> <body> <div onblur="javascript:Callme();"> <input type

onclick() and onblur() ordering issue

泄露秘密 提交于 2019-11-28 05:09:57
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 menu, the menu should be removed, and special processing should occur based on which div was clicked. Here is my implementation: The input field has an onblur() event which deletes the menu (by setting its parent's innerHTML to an empty string) whenever the user clicks outside the input field. The divs inside the menu also have onclick() events which

Javascript newbie - seems that onBlur of one element is “overriding” the onclick of another

时光怂恿深爱的人放手 提交于 2019-11-28 05:08:04
问题 I have two elements: <input type="text" name="pmTo" id="pmTo" onkeyup="offerSuggs('none');" onfocus="showSelect();" onblur="hideSelect();" /> and a dynamically created one (this is all part of an auto suggest program): $suggString .= '<div name="'.$value.'" id="'.$value.'" class="suggMouseOver" onmouseover="highlightDivs(this);" onmouseout="blurDivs(this);" onclick="fillInput(this);">'.$value.'</div>'; Okay, and then there are the event functions that correspond to the onblur of the input

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

蹲街弑〆低调 提交于 2019-11-27 23:28:52
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 blur. The problem is that when the user clicks on the div's scrollbar, IE wrongly fires the onblur event, whereas Firefox doesn't. I guess Firefox still treats the scrollbar as part of the div, which I think is correct. I just want IE to behave the same way. I'm having a similar problem with IE firing the blur event when you click on a scrollbar.

How to determine where focus went?

浪子不回头ぞ 提交于 2019-11-27 14:57:13
问题 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 which element now has focus. I'm using regular javascript; no jQuery for this one, please. Is that possible these days? 回答1: You can try something like this: function whereDidYouGo() { var all = document.getElementsByTagName('*'); for (var i = 0; i

How to use onBlur event on Angular2?

ⅰ亾dé卋堺 提交于 2019-11-27 12:31:56
How do you detect an onBlur event in Angular2? I want to use it with <input type="text"> Can anyone help me understand how to use it? Use (eventName) for while binding event to DOM, basically () is used for event binding. Also use ngModel to get two way binding for myModel variable. Markup <input type="text" [(ngModel)]="myModel" (blur)="onBlurMethod()"> Code export class AppComponent { myModel: any; constructor(){ this.myModel = '123'; } onBlurMethod(){ alert(this.myModel) } } Demo Alternative(not preferable) <input type="text" #input (blur)="onBlurMethod($event.target.value)"> Demo For model

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

限于喜欢 提交于 2019-11-27 12:24:32
问题 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 some other way. I would also like to know if there is a way to achieve this using any javascript libraries like jquery. Thank you, this is the sample html code <html> <head> <title>Div Onblur test</title> <script type="text/javascript"> function

onclick() and onblur() ordering issue

為{幸葍}努か 提交于 2019-11-27 05:21:12
问题 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 menu, the menu should be removed, and special processing should occur based on which div was clicked. Here is my implementation: The input field has an onblur() event which deletes the menu (by setting its parent's innerHTML to an empty string)

Get the clicked object that triggered jquery blur() event [duplicate]

别等时光非礼了梦想. 提交于 2019-11-27 01:31:06
This question already has an answer here: When a 'blur' event occurs, how can I find out which element focus went *to*? 23 answers 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 action rather than the clicked object. daryl If I understand your question correctly, this should do it: $(function() { var clicky; $(document).mousedown(function(e) { // The latest element clicked clicky = $(e.target); }); /

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

久未见 提交于 2019-11-26 21:28:29
问题 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 blur. The problem is that when the user clicks on the div's scrollbar, IE wrongly fires the onblur event, whereas Firefox doesn't. I guess Firefox still treats the scrollbar as part of the div, which I think is correct. I just want IE to behave the same