The onblur for element 13 specifies element 12 in the call. Note that when you tab out of 12, the javascript triggers because 13 gets focus. Then because 12 is empty, you set it's focus back, which causes the onblur of 13 to trigger, thus overwriting the message from 12.
pritaeas
Posting Prodigy
9,297 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,463
Skill Endorsements: 86
pritaeas
Posting Prodigy
9,297 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,463
Skill Endorsements: 86
Loop I didn't used loop any where
When you tab out of elem12, elem13 gets focus and elem12 onblur is triggered. Because it is empty, elem12 gets focus, thus triggering elem13's onblur. Because it is empty, .... and so on. You need a way to break this loop.
pritaeas
Posting Prodigy
9,297 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,463
Skill Endorsements: 86
Perhaps a global variable to indicate that the onblur function should skip the set focus.
pritaeas
Posting Prodigy
9,297 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,463
Skill Endorsements: 86
formValidation
Your function never returns true.
pritaeas
Posting Prodigy
9,297 posts since Jul 2006
Reputation Points: 1,178
Solved Threads: 1,463
Skill Endorsements: 86
Line 35 & 54, unreachable statements -- no need to be in there. When you have if-else statement and both return a value, any codes below it will be unreachable.
As pritaeas said, inner most of your if-condition should return something, or the last statement (return false) will be executed.
Taywin
Posting Maven
2,633 posts since Apr 2010
Reputation Points: 275
Solved Threads: 375
Skill Endorsements: 17