Click to See Complete Forum and Search --> : onblur() becoming issue
rd13
June 2nd, 2008, 04:10 PM
I have a function which is called every time input element's onblur() event is called and it adds a new button to the form. But, the problem is ...i also have a drop down list. Now everytime i try to select something from dropdown list, on blur() of input is called. Is there a way to prevent onblur() when drop downlist is used ?
PeejAvery
June 2nd, 2008, 07:20 PM
The onblur event of one element will always fire before the onfocus event of another element. The only way around this is to use setTimeout() to give the next element time.
You could create a global variable on which the creation of a new button will depend. If the global variable is equal to true, then create a new button. If not, then don't. Then you can set the global variable depending on whether or not the next element to gain focus is a select or input element.
rd13
June 3rd, 2008, 01:39 AM
SetTimetout ...hmm not sure how to do that. Onblur() is called even when i click anywhere on the form. May be creating a global variable is a good idea.
thanks for your advice
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.