Posted By

wirenaught on 05/25/11


Tagged

input focus textarea


Versions (?)

check if <input> or <textarea> has the focus


 / Published in: JavaScript
 

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

  1. window.onload = function() {
  2. for (i=0; i<form.elements.length-1; i++) {
  3. elem = document.forms['quick_reply'].elements[i];
  4. elem.focused = false;
  5. elem.hasFocus = function() {
  6. return this.focused;
  7. };
  8. elem.onfocus=function() {
  9. this.focused=true;
  10. };
  11. elem.onblur=function() {
  12. this.focused=false;
  13. };
  14. }
  15. }

Report this snippet  

You need to login to post a comment.