![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
What is wrong with this code? When I only assign the onblur call to one of the input fields everythings work, but when I as belove use it on both fields I'll get an endless loop with the alert messages repeating/replacing each other. I'll guess that the problem/error must be somewhere in the focus expression but where is it? |
#2
| |||
| |||
|
|
please-answer-here wrote: What is wrong with this code? When I only assign the onblur call to one of the input fields everythings work, but when I as belove use it on both fields I'll get an endless loop with the alert messages repeating/replacing each other. I'll guess that the problem/error must be somewhere in the focus expression but where is it? It is well-known that using validation code in onblur handlers that calls alert can trigger an endless loop of focus/blur events and thus you should not use that. If you want to validate use the onsubmit handler of the <form> element or if you really see a need to validate each control after the user has input something then use the onchange handler. |
![]() |
| Thread Tools | |
| Display Modes | |
| |