Return to Snippet

Revision: 46799
at May 25, 2011 15:20 by wirenaught


Initial Code
window.onload = function() {
    for (i=0; i<form.elements.length-1; i++) {
        elem = document.forms['quick_reply'].elements[i];
        elem.focused = false;
        elem.hasFocus = function() {
            return this.focused;
        };
        elem.onfocus=function() {
            this.focused=true;
        };
        elem.onblur=function() {
            this.focused=false;
        };
    }
    }

Initial URL
http://www.ozzu.com/programming-forum/using-javascript-check-the-focus-element-t76858.html

Initial Description

                                

Initial Title
check if &lt;input&gt; or &lt;textarea&gt;  has the focus

Initial Tags

                                

Initial Language
JavaScript