Posted By

cyberhobo on 09/02/09


input DOM text focus disable enable textBox

Versions (?)

Disable and enable a text input in Firefox

 / Published in: JavaScript

I just noticed in Firefox 3.5.2 that setting disabled = true for a focused text input seems to make it impossible to re-focus after setting disabled = false. The solution is to blur it before disabling.

  1. var my_textbox = document.getElementById( 'my_textbox' );
  3. my_textbox.blur();
  4. my_textbox.disabled = true;
  6. // later...
  7. my_textbox.disabled = false;
  8. my_textbox.focus();

Report this snippet  

You need to login to post a comment.