focusout

How to run a function after div has lost focus?

拈花ヽ惹草 提交于 2020-01-05 05:43:10
问题 I have several divs that each contain a form . Each of the forms has two input text fields . I am trying to trigger a function after div looses focus (meaning, not after one of the input text fields looses focus, but after totally new form in new div gains focus). <div class='userInput' id='userInputID'> <div class='col1'> <form id='form1' method='post' action='BuyOrder.php'> <input type='text' name='r1' id='r1' value=''><br /> <input type='text' name='b1' id='b1' value=''><br /> <button id=

jquery focusout event missing relatedTarget information

亡梦爱人 提交于 2020-01-02 08:16:09
问题 i have a text input that is bound to focusin / focusout events. $(element) .focusin(function(e) {}) .focusout(function(e) { var to = e.relatedTarget || e.toElement; // undefined in chrome, fine in IE }); on focusout , i'm interested in the relatedTarget information, i.e., the DOM element receiving focus as the text input loses focus, however this property is undefined for the event. on the other hand, toElement , which i believe is the internet explorer equivalient of relatedTarget , is

focusout on an element conflicting with click on other in Angular

落花浮王杯 提交于 2019-12-24 01:18:50
问题 I have focusout() event on element1 and click() event on element2 , and when element1 goes out of focus because was performed a click event on element2 , only focusout is fired, click event is not. This works fine [on jQuery][1] but not in Angular. I found a work around by adding a window.setTimeout() which works for angular too. Unfortunately I can not do this. Another suggestion is much appreciated. Please find the code with setTimeout: $('#txtName').on("focusout",function(event) { /

JavaScript FocusOut - get the element that receives focus

淺唱寂寞╮ 提交于 2019-12-22 03:50:33
问题 When the FocusOut event is raised, how do you know which element receives the focus ? The correct way seems to be to use the event's relatedTarget property. However, this seems not to work in all browsers: in Google Chrome, it works in Firefox and Internet Explorer, the relatedTarget is null in Safari, the relatedTarget property doesn't even exist I have found a workaround which works only in IE (using document.activeElement), but I'm wondering if there isn't a general solution that has

Make Slicknav menu close when outside click on IOS devices

梦想与她 提交于 2019-12-11 08:04:37
问题 I'm using the Slicknav mobile menu script: http://slicknav.com/ And it's working great except I can't figure out how to get it to close when one clicks outside of the menu on ios devices. It closes fine when clicking outside when I test it on desktop and Android, but on my Ipad it's not working. Here's the current code. Any insight? Thank you! <script src="slicknav.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('.menu').slicknav({ label:'', closeOnClick:true });

Mouseleave event not firing consistently in Firefox after focusout event

南楼画角 提交于 2019-12-11 02:53:05
问题 I am running the following code: <html> <body> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script> <script type="text/javascript"> $(document).ready(function() { $('html').on('mouseleave', function(e) { console.log('mouseleave'); }); $('#text1').on('focusout', function () { alert("focusout"); setTimeout(function(){$('#text1')[0].focus();},0); }); }); </script> <input type=text id="text1"> </body> </html> When I move the mouse up to the browser toolbar/tabs

jQuery - Focus out on TR

让人想犯罪 __ 提交于 2019-12-06 03:33:37
问题 Okay, so I'm making a plugin to allow inline editing of tables in my website, going great so far, I've got most of it done, but I can't seem to get Focusing out of the table right. So if someone is done editing and starts editing a new row or just clicks out of the row, it should save and go back to normal. But if I use blur on the row, there's no response, but if I use blur on the element, it triggers when people swap from one element to another But if I use focusout on the row, it triggers

jquery focusout event missing relatedTarget information

淺唱寂寞╮ 提交于 2019-12-05 19:44:09
i have a text input that is bound to focusin / focusout events. $(element) .focusin(function(e) {}) .focusout(function(e) { var to = e.relatedTarget || e.toElement; // undefined in chrome, fine in IE }); on focusout , i'm interested in the relatedTarget information, i.e., the DOM element receiving focus as the text input loses focus, however this property is undefined for the event. on the other hand, toElement , which i believe is the internet explorer equivalient of relatedTarget , is available. in other words, my focusout handler works fine in IE, but not in other browsers. is there a

JavaScript FocusOut - get the element that receives focus

好久不见. 提交于 2019-12-05 01:44:31
When the FocusOut event is raised, how do you know which element receives the focus ? The correct way seems to be to use the event's relatedTarget property. However, this seems not to work in all browsers: in Google Chrome, it works in Firefox and Internet Explorer, the relatedTarget is null in Safari, the relatedTarget property doesn't even exist I have found a workaround which works only in IE (using document.activeElement), but I'm wondering if there isn't a general solution that has proven to work in all major browsers . Although I can find similar questions and answers, I haven't found

jQuery - Focus out on TR

天涯浪子 提交于 2019-12-04 07:03:24
Okay, so I'm making a plugin to allow inline editing of tables in my website, going great so far, I've got most of it done, but I can't seem to get Focusing out of the table right. So if someone is done editing and starts editing a new row or just clicks out of the row, it should save and go back to normal. But if I use blur on the row, there's no response, but if I use blur on the element, it triggers when people swap from one element to another But if I use focusout on the row, it triggers whenever someone leaves the element as well, even if they click in the same row. Nor is there anything