Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
176
rated 0 times [  177] [ 1]  / answers: 1 / hits: 16961  / 13 Years ago, thu, september 8, 2011, 12:00:00

There is a function OPEN in my javascript which is called when the user either blur (lose focus on the input field) or hit Enter.



Then within OPEN(), depending on whether it was triggered by blur or keypress, it leads to two different other functions.



For the Keypress, I did it like this.



        if (e.keyCode==13) ENTER_FX();


How do you do this for BLUR



Thank you



UPDATE:



I found that it should be e.type==focusout



So is focusout the right word instead of blur?


More From » events

 Answers
15

WORKING JSFIDDLE EXAMPLE



e.type


gives you this information



function OPEN(e) {
if (e.type !== blur) {
if (e.keyCode === 13) {
ENTER_FX();
}
}
else {
ENTER_FX();
}
}

[#90193] Wednesday, September 7, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
carolynt

Total Points: 252
Total Questions: 98
Total Answers: 109

Location: French Southern and Antarctic Lands
Member since Sat, Oct 31, 2020
4 Years ago
;