Javascript blur doesn't work

I have a very simple code:

>  $("#priv").blur(function(){
>    document.getElementById('priv').innerHTML = '';
>          return false;
>     });

the function should set span with id priv to empty(hide the content), if clicked on other stuff on the site etc. but it’s not working I am probably missing something, why blur doesn’t trigger?

Thank you

I doubt a span is a focusable element (AFAIK that’s only for window, links, and form elements), which is the condition that the blur/focus events can be triggered in the first place.

it might work if you add a tabindex attribute.

Thank you! I will see later, also “may be” useful:

That’s a pretty good reference on how it used to be done in Netscape 4 - back in the days (about 15 years ago) when you had to jumble HTML and JavaScript together instead of keeping them separate.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.