Onblur Fails... Onclick works?!

JavaScript related questions should go here.
Post Reply
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Onblur Fails... Onclick works?!

Post by unemployment »

Why won't onblur work? onclick works!
var allDivs = document.getElementsByTagName('div');
for (var i=0; i< allDivs.length; i++)
{
    if (allDivs.className.indexOf('goal_icon_holder') != -1)
    {
        allDivs.onblur = function()
        {
            alert('test');
        }
       
        allDivs.onclick = function()
        {
            alert('test');
        }
    }
}
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Onblur Fails... Onclick works?!

Post by jacek »

perhaps divs don’t have focus events, it would not make much sense.
Image
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Re: Onblur Fails... Onclick works?!

Post by unemployment »

jacek wrote:perhaps divs don’t have focus events, it would not make much sense.
perhap you are right... in fact you are correct.
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Re: Onblur Fails... Onclick works?!

Post by unemployment »

I finally fixed my awful JS problem... 7 days later err
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Onblur Fails... Onclick works?!

Post by jacek »

unemployment wrote:I finally fixed my awful JS problem... 7 days later err
Good news :) JavaScript does tend to be a bit horrid.
Image
Post Reply