Santhosh Santhosh - 2 months ago 9
Javascript Question

textbox focus out

I need to focus out from the textbox when it focus in.

I try to set focus for outer div and its working fine in IE but not in mozilla.

How do I do this?

This is my current code:

<div id="outer"> <input type = "textbox" /></div> Onfocus: document.getElementById("outer").focus()

Answer

I have tried all the answers and not worked in all the browsers. And I combined all together in to it.

  1. TextBox.readonly = true;

OnFocus:

  1. var curText = TextBox.value; TextBox.value = ""; TextBox.value = curText;

  2. TextBox.blur();

  3. TextBox_Parent.focus()

And its working fine in all the browsers