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 tu
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");
An easy fix could be done by adding CSS :
div_selector{
pointer-events: none;
}
Or By adding same css via jQuery :
$(div_selector).css('pointer-events', 'none');
I'm not sure if you can make an element 'un-focusable', but you can certainly un-focus it at a specific point in time using its blur method:
document.getElementById("myElement").blur();
EDIT:
I think you can make an element 'un-focusable' by defocusing it every time it is focused. You can accomplish this via:
document.getElementById("myElement").onfocus = function() {
this.blur();
};
...or (using inline Javascript in your HTML):
<div onfocus="this.blur();"></div>
Steve
Below is the some way to make DIV unfocusable using jquery.
// Set the tabindex atribute to -1.
1)$("divid").attr('tabindex','-1');
// Remove the tabindex atribute if exists.
2) $("divid").removeAttr('tabindex');
// This is third way.
3) $("divid").blur();
Additionally, If you want to make a focussable element(form input elements etc.) as unfocussable. You can set :
tabIndex = "-1"
document.getElementById("yourElement").setAttribute("tabIndex", "-1");