Search code examples
javascripthtmlfocus

how to make a DIV unfocusable?


I met a problem about HTML rendering.

In dir="rtl" document of IE7, when JavaScript tries to set focus to a DIV element(with oElement.focus() method), the rendering turns to mess. The context is very complicated, so I suppose the easiest fix is to make the DIV unfocusable?

Is there any way to make a DIV not be focused?


Solution

  • The <div> should not be capable of receiving focus unless you have added tabIndex.

    If you have added tabIndex, you should remove it by

    document.getElementById("yourElement").removeAttribute("tabIndex");